1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

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.
This commit is contained in:
Carlos O'Donell
2016-10-29 23:45:40 -04:00
parent 960294f00a
commit 93fe09cb5f
8 changed files with 91 additions and 1 deletions

View File

@ -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 */