Re: [PATCH] features.h: Fix -Wundef problems
Corinna Vinschen <[email protected]> Thu, 4 Dec 2025 11:10:12 +0100
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Dec 3 03:48, Stefan Tauner wrote: > [...] > From 4667f7d3f13cfc051db048efbf1636ecc25d2532 Mon Sep 17 00:00:00 2001 > From: Stefan Tauner <[email protected]> > Date: Sat, 29 Nov 2025 22:52:26 +0100 > Subject: [PATCH] features.h: Fix -Wundef problems > > -Wundef warns if an undefined identifier is evaluated in an #if > directive. This would be valid as they are replaced with 0. However, it > is often an early warning sign and not intentional. To allow for > enabling -Wundef even outside system directories (where compilers > ignore such problems unless -Wsystem-headers is enabled) this patch > adds the required defined() checks. > > glibc also has been supporting this for 10 years now: > https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f248238cf43bd751db29e6f151d6da7645337ff5 > > I have not exhaustively tested this but you can see the effect with > something like the following (+ using -stdc= and/or -D...): > echo | gcc -include newlib/libc/include/sys/features.h -Inewlib/libc/include/ -E - -Wundef > > Signed-off-by: Stefan Tauner <[email protected]> > --- > newlib/libc/include/sys/features.h | 49 +++++++++++++++++------------- > 1 file changed, 28 insertions(+), 21 deletions(-) Pushed. Thanks, Corinna