This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 2/2] Deprecate inclusion of sys/sysmacros.h by sys/types.h.
- From: Zack Weinberg <zackw at panix dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 10 May 2016 10:13:22 -0400
- Subject: Re: [PATCH 2/2] Deprecate inclusion of sys/sysmacros.h by sys/types.h.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1461444595 dot git dot zackw at panix dot com> <361004a869a7731e6f8161be9fe5da9c5446dc99 dot 1461444595 dot git dot zackw at panix dot com> <571DC63C dot 7080708 at redhat dot com> <CAKCAbMjcn_K=_qbbSL4wFiX6ygHePrXyjcyB1T_aHLwgs=5GJQ at mail dot gmail dot com>
On 04/25/2016 09:50 AM, Zack Weinberg wrote:
> On Mon, Apr 25, 2016 at 3:24 AM, Florian Weimer <email@example.com> wrote:
>> Why do we need these new functions? Recent GCC has support for emitting
>> warnings from macros, if that's what you need.
> I shall look into the warnings-from-macros feature; maybe it will get
> me out of having to use __REDIRECT.
Assuming the feature you were thinking of is
_Pragma("GCC warning \"...\"")
it is not useful for this task, because _Pragma accepts only a _single_
string literal as its argument; you cannot use string literal
concatenation to assemble a message. The C standard seems to think it's
good enough to be able to assemble a _Pragma directive as unquoted
tokens and then stringify it all in one go, e.g.
#define _PRAGMA(whatever) _Pragma(#whatever)
_PRAGMA(GCC warning "...")
... but that is also impractical in this case because the desired
warning message includes the names of macros. I *might* be able to use
token-pasting with dummy empty arguments to shield everything from
expansion till just the right point, but it would be messy to the point
of illegibility, and this is already messy enough.