about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2016-10-29 23:45:40 -0400
committerCarlos O'Donell <carlos@redhat.com>2016-10-29 23:50:56 -0400
commit93fe09cb5fbf68e473d5514adc069d2f6115cc23 (patch)
tree5feb90cefe21213db677fc6d331563132ffe3cc6 /include
parent960294f00a33559af40143ac056f68d21c006d27 (diff)
downloadglibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.gz
glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.tar.xz
glibc-93fe09cb5fbf68e473d5514adc069d2f6115cc23.zip
Bug 20729: Fix building with -Os.
This commit adds a new DIAG_IGNORE_Os_NEEDS_COMMENT which is only
enabled when compiling with -Os. This allows developers working on
-Os enabled builds to mark false-positive warnings without impacting the
warnings emitted at -O2.

Then using the new DIAG_IGNORE_Os_NEEDS_COMMENT we fix 6 warnings
generated with GCC 5 to get -Os builds working again.
Diffstat (limited to 'include')
-rw-r--r--include/libc-internal.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 7a185bbdc7..e4395dd5c5 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -111,4 +111,19 @@ extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
 #define DIAG_IGNORE_NEEDS_COMMENT(version, option)	\
   _Pragma (_DIAG_STR (GCC diagnostic ignored option))
 
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
+   diagnostic OPTION but only if optimizations for size are enabled.
+   This is required because different warnings may be generated for
+   different optimization levels.  For example a key piece of code may
+   only generate a warning when compiled at -Os, but at -O2 you could
+   still want the warning to be enabled to catch errors.  In this case
+   you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
+   only for -Os.  */
+#ifdef __OPTIMIZE_SIZE__
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)	\
+  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+#else
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
+#endif
+
 #endif /* _LIBC_INTERNAL  */