WG14 has demonstrated sincere interest in adding C++-style attributes to C for C2x, and have added the proposal to their SD-3 document tracking features which are possibly desired for the next version of the standard. The proposal has *not* been formally adopted into the working draft (C17 needs to be finalized first), but it is at the stage where having implementation experience is important to the committee.
This patch implements the feature as proposed, but it might make sense to split the patch up, depending on what we think is the correct way to proceed. This patch adds c2x as a new language standard as well as -fc-attributes and -fno-c-attributes flags. The intention is that -std=c2x will enable -fc-attributes once the feature is formally adopted by WG14, but -fc-attributes can be used to enable the functionality in earlier standard modes (but is currently required in order to enable the functionality). fno-c-attributes is provided on the chance that the syntax proposed causes parsing issues for Objective-C and users need a way to work around that; however, such cases should be considered bugs that we need to work around similar to Objective-C++ and C++11-style attributes. The patch also adds support for the deprecated attribute (WG14 N2050), mostly so that I would have an attribute handy to test the semantic functionality. Once the basic syntax is committed, I plan to implement the other attributes: nodiscard (WG14 N2051), fallthrough (WG14 N2052), and maybe_unused (WG14 N2053) in separate patches.
Can we give this a more general name, then enable it under CPlusPlus too? That's what we do for other similar features.