This is the mail archive of the gcc-patches@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]

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


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.

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