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.
This augments the texi docs that list attribute keys with
a note of what version introduced the feature. The version
information was obtained through archaeology of the GCC source
repository release tags, back to gcc-4_0_0-release. For
attributes added in 4.0.0 or later, an explicit version will
be noted. Any attribute that predates 4.0.0 will simply note
that it has existed prior to 4.0.0. It is thought there is
little need to go further back in time than 4.0.0 since few,
if any, apps will still be using such old compiler versions.
A few years ago I created something like this for command line
options. I used a script to download the GCC manual for each
version, extract new command line options from the index, and
tabulate them.
Where a named attribute can be used in many contexts (ie the
'visibility' attribute can be used for both functions or
variables), it was assumed that the attribute was supported
in all use contexts at the same time.
Future patches that add new attributes to GCC should be
required to follow this new practice, by documenting the
version.
I think this is great material. I don't have a strong opinion
on where it belongs (the manual, the Wiki, or somewhere else),
but given how tedious it can be to get at this information I
think having it available somewhere in some form could be quite
useful. (I specifically needed it in a tabular form, with
option names on left and versions in columns.)
Martin
PS The version information isn't just used by engineers writing
code (where I agree that having a portable API to query it would
be more robust than copying it from a static page). In my
experience, it's also used to drive decisions about adopting
different versions of GCC or versions of other compilers that
aim to be (near) 100% GCC compatible (such as Intel ICC).