This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c/66970] Add __has_builtin() macro


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970

kim.walisch at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kim.walisch at gmail dot com

--- Comment #6 from kim.walisch at gmail dot com ---
> Why do you need this?

1) Because clang already supports it and people like myself would like to
simplify their code i.e. have a single macro for both GCC and clang.

2) Without this macro one needs to check if a __builtin_* macro exists using
the build system (Autotools, CMake) which requires more complicated code or one
needs a nasty macro which checks the __GNUC__ and __GNUC_MINOR__ versions. The
__has_attribute() macro is much more elegant than the other two options.

> You still need to check for older versions of the
> compilers (which don't support __has_attribute()) anyways.

Not everybody needs to support old compiler versions. My company regularly
upgrades to the latest Linux version. After such an upgrade we are allowed to
use new compiler features.

There are also lots of developers out there who only care if their program
compiles with a fairly recent compiler (e.g. not older than 5 years). If GCC
would implement __has_attribute() today than it would become very useful in
just a few years.

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