Adding a -W flag for "using extended field designator is an extension"

"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. :slight_smile:

Jeff

0. http://llvm.org/viewvc/llvm-project?view=rev&revision=142284

extended-offsetof.diff (1.64 KB)

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

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).

Makes sense -- and for its concision as well.

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

I was going from <http://clang.llvm.org/hacking.html>, which does suggest cfe-commits first. But it also says "if you have questions, or want to have a wider discussion of what you are doing, such as if you are new to Clang development, you can use the cfe-dev mailing list". Since these points applied, I went with cfe-dev. It might be worth clarifying that somehow.

Committed as r144160 with that tweak, thanks!

Excellent, thanks!

Jeff

Ah, thanks for pointing that out! I've tweaked the guidelines.

  - Doug