Blame include/libc-diag.h

Packit Service 82fcde
/* Macros for controlling diagnostic output from the compiler.
Packit Service 82fcde
   Copyright (C) 2014-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#ifndef _LIBC_DIAG_H
Packit Service 82fcde
#define _LIBC_DIAG_H 1
Packit Service 82fcde
Packit Service 82fcde
/* Ignore the value of an expression when a cast to void does not
Packit Service 82fcde
   suffice (in particular, for a call to a function declared with
Packit Service 82fcde
   attribute warn_unused_result).  */
Packit Service 82fcde
#define ignore_value(x) \
Packit Service 82fcde
  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
Packit Service 82fcde
Packit Service 82fcde
/* The macros to control diagnostics are structured like this, rather
Packit Service 82fcde
   than a single macro that both pushes and pops diagnostic state and
Packit Service 82fcde
   takes the affected code as an argument, because the GCC pragmas
Packit Service 82fcde
   work by disabling the diagnostic for a range of source locations
Packit Service 82fcde
   and do not work when all the pragmas and the affected code are in a
Packit Service 82fcde
   single macro expansion.  */
Packit Service 82fcde
Packit Service 82fcde
/* Push diagnostic state.  */
Packit Service 82fcde
#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
Packit Service 82fcde
Packit Service 82fcde
/* Pop diagnostic state.  */
Packit Service 82fcde
#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
Packit Service 82fcde
Packit Service 82fcde
#define _DIAG_STR1(s) #s
Packit Service 82fcde
#define _DIAG_STR(s) _DIAG_STR1(s)
Packit Service 82fcde
Packit Service 82fcde
/* Ignore the diagnostic OPTION.  VERSION is the most recent GCC
Packit Service 82fcde
   version for which the diagnostic has been confirmed to appear in
Packit Service 82fcde
   the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
Packit Service 82fcde
   just MAJOR for GCC 5 and later).  Uses of this pragma should be
Packit Service 82fcde
   reviewed when the GCC version given is no longer supported for
Packit Service 82fcde
   building glibc; the version number should always be on the same
Packit Service 82fcde
   source line as the macro name, so such uses can be found with grep.
Packit Service 82fcde
   Uses should come with a comment giving more details of the
Packit Service 82fcde
   diagnostic, and an architecture on which it is seen if possibly
Packit Service 82fcde
   optimization-related and not in architecture-specific code.  This
Packit Service 82fcde
   macro should only be used if the diagnostic seems hard to fix (for
Packit Service 82fcde
   example, optimization-related false positives).  */
Packit Service 82fcde
#define DIAG_IGNORE_NEEDS_COMMENT(version, option)     \
Packit Service 82fcde
  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
Packit Service 82fcde
Packit Service 82fcde
/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
Packit Service 82fcde
   diagnostic OPTION but only if optimizations for size are enabled.
Packit Service 82fcde
   This is required because different warnings may be generated for
Packit Service 82fcde
   different optimization levels.  For example a key piece of code may
Packit Service 82fcde
   only generate a warning when compiled at -Os, but at -O2 you could
Packit Service 82fcde
   still want the warning to be enabled to catch errors.  In this case
Packit Service 82fcde
   you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
Packit Service 82fcde
   only for -Os.  */
Packit Service 82fcde
#ifdef __OPTIMIZE_SIZE__
Packit Service 82fcde
# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
Packit Service 82fcde
  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
Packit Service 82fcde
#else
Packit Service 82fcde
# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#endif /* libc-diag.h */