see also: https://gcc.gnu.org/gcc-7/changes.html (the actual change list)
Some highlights in my opinion:
-Wimplicit-fallthroughand its recognition of fallthrough-comments
-Wformat-overflowfor detecting likely overflows in
-Wnonnulllooks pretty sweet too if you’ve been taking the time to leverage that attribute
Things I would still love to see from gcc:
-Weverything. Come on folks, even if you don’t want it, some of us do.
Frankly, if gcc adds a
-Weverything, that’d be enough for me to switch back to it from clang.
On a final note, something I really want to see from the C standard:
A standardized way of specifying attributes.
You can do a bit of instrumentation to declare an attribute semi-portably:
#if !defined(__has_attribute) # define __has_attribute(x) 0 #endif #if __has_attribute(pure) # define PURE __attribute__((pure)) #else # define PURE #endif
The above will let me decorate a function with
PURE without causing issue on compilers which do not know about it, but I have yet to discover a way I can make a function-like macro
ATTR(x) which expands to
__has_attribute is defined and when
__has_attribute(x) is true. If that function-like macro could somehow be created, or if a standardized interface could be defined for attaching attributes, I would be very excited.