This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Deprecate inclusion of sys/sysmacros.h by sys/types.h.

On 04/25/2016 09:50 AM, Zack Weinberg wrote:
> On Mon, Apr 25, 2016 at 3:24 AM, Florian Weimer <> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]