Blame SOURCES/glibc-rh677316-libc-diag.patch

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