[PATCH] gcc/doc: list what version each attribute was introduced in

Mike Stump mikestump@comcast.net
Fri Jul 7 19:33:00 GMT 2017


On Jul 7, 2017, at 10:01 AM, Jeff Law <law@redhat.com> wrote:
> 
> On 07/06/2017 07:25 AM, Daniel P. Berrange wrote:
>> There are several hundred named attribute keys that have been
>> introduced over many GCC releases. Applications typically need
>> to be compilable with multiple GCC versions, so it is important
>> for developers to know when GCC introduced support for each
>> attribute.

> Keying on version #s is generally a terrible way to make your code
> portable.

> It's far better to actually *test* what your particular compiler
> compiler supports

So, if someone wanted to explore ways to make code that uses these better; a possibility might be to use __has_builtin a la clang:

  https://clang.llvm.org/docs/LanguageExtensions.html

It also has __has_feature and __has_extension.  At least it seems reasonably complete, and then people can feature test specific bits on a fine grained basis.

It doesn't solve history (without a re-release of old versions), but, it can provide a framework for solving the problem for the future.


More information about the Gcc-patches mailing list