This is the mail archive of the libc-alpha@sourceware.org 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 1/2] Add __clang_has_extension to sys/cdefs.h.


I think this is a bad addition.  I don't think we want miscellaneous header
files to have Clang-specific #if checks.  What we really want is for header
files to do specific feature checks using some compiler-independent macros
defined by <sys/cdefs.h>.  This is also superior to the existing cases of
headers using __GNUC_PREREQ as a proxy for specific feature tests.

As Florian and Paul mentioned, new macros should avoid name space issues.
Just use the prefix __glibc_ on any new macro.

I think a generalized thing like __glibc_has_feature (foobar) would be
fine.  sys/cdefs.h can do a variety of macro magic things to map that to
what works in Clang and to __GNUC_PREREQ for GCC.  This is probably also
the best way to enable distros that backport features to their compilers to
update the corresponding conditionals easily, i.e. they can just patch
sys/cdefs.h in their glibc package to change some of these macro
definitions rather than dealing with the __GNUC_PREREQ mess throughout all
the headers.

You don't need to do the whole conversion for us, of course.  But look at
existing __GNUC_PREREQ tests and make sure that the scheme you come up with
will extend readily to cover all those cases.


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