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

Jeff Walden jwalden+clang at mit.edu
Mon Nov 7 12:23:55 PST 2011


"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?

Also, I've cargo-culted this from another revision[0], so if the patch is totally off-base, please say so.  :-)

Jeff

0. http://llvm.org/viewvc/llvm-project?view=rev&revision=142284
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: extended-offsetof.diff
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111107/8b318d06/attachment.ksh>


More information about the cfe-dev mailing list