This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Fix -Os related build and test failures.
On 10/28/2016 10:57 PM, Carlos O'Donell wrote:
> OK?
>
> 2016-10-28 Carlos O'Donell <carlos@redhat.com>
>
> [BZ #20729]
> * include/libc-internal.h (DIAG_IGNORE_Os_NEEDS_COMMENT):
> Define.
> * iso-2022-cn-ext.c: Include libc-internal.h and ignore
> -Wmaybe-uninitialized for BODY macro only for -Os compiles.
> * locale/weight.h (findix): Ignore -Wmaybe-uninitialized error
> for seq2.back_us and seq1.back_us only for -Os compiles.
> * locale/weightwc.h (findix): Likewise.
> * nptl_db/thread_dbP.h: Ignore -Wmaybe-uninitialized error for
> DB_GET_FIELD_ADDRESS only for -Os compiles.
> * resolv/res_send (reopen): Ignore -Wmaybe-uninitialized error
> for slen only for -Os compiles.
> * string/strcoll_l.c (get_next_seq): Ignore
> -Wmaybe-uninitialized for seq2.save_idx and seq1.save_idx only
> for -Os compiles.
>
> +/* 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. */
> +#if __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
Typo. s/if/ifdef/g, since __OPTIMIZE_SIZE__ is not defined at -O2.
Fixed.
--
Cheers,
Carlos.