[cfe-dev] Adding a -W flag for "using extended field designator is an extension"

Douglas Gregor dgregor at apple.com
Tue Nov 8 19:04:31 PST 2011


On Nov 7, 2011, at 12:23 PM, Jeff Walden wrote:

> "offsetof(T, field,subfield)" and "offsetof(T, arr[3])" are C/C++ extensions; only "offsetof(T, field)" is standard.  Clang warns about these with -pedantic, but there's no -W flag for this warning, so I can't disable it.  This patch adds -Wno-offsetof-extended-field-designator for this.
> 
> I don't know if this should be a new -W or simply be grouped under -Winvalid-offsetof.  The purposes of the two seem different, and finer-grained warnings seem preferable, so I've made a new warning.  This is my first patch, so I have no idea what the norm is for this.  Would using invalid-offsetof be better?


This looks great. I ended up going with the name "-Wextended-offsetof", in case we get any more extensions to offsetof (and to match up with -Winvalid-offsetof a bit more closely). 

Oh, please send future patches to cfe-commits. We prefer to handle patch reviews there, rather than 

Committed as r144160 with that tweak, thanks!

	- Doug



More information about the cfe-dev mailing list