[PATCH] D43359: Clean up 'target' attribute diagnostics

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 08:42:23 PST 2018


aaron.ballman added inline comments.


================
Comment at: test/Sema/attr-target.c:9-10
 int __attribute__((target("fpmath=387"))) walrus() { return 4; } //expected-warning {{ignoring unsupported 'fpmath=' in the target attribute string}}
+// expected-warning at +1 {{'target' attribute ignored}}
 int __attribute__((target("avx,sse4.2,arch=hiss"))) meow() {  return 4; }//expected-warning {{ignoring unsupported architecture 'hiss' in the target attribute string}}
+// expected-warning at +1 {{'target' attribute ignored}}
----------------
erichkeane wrote:
> aaron.ballman wrote:
> > Is there ever a case where you *won't* get the "ignoring unsupported" without also getting the "'target' attribute ignored" warning as well? It seems a bit chatty to give two diagnostics for each mistake, and it makes one of those diagnostics seem incorrect -- in this case, one diagnostic says "ignoring unsupported architecture 'hiss'", implying the others are not ignored, but then the second diagnostic says the whole attribute is ignored.
> There is not... I actually put in the second because I thought that the 1st (ignoring unsupported...) was pretty ambiguous.  I'll rev this patch seeing if I can simply make the former more clear.
I think that makes sense. Or, alternatively, make the first diagnostic accurate by dropping all unsupported targets (leaving the valid ones) and adjusting the diagnostic wording depending on whether the whole attribute is dropped, or just parts of it?


https://reviews.llvm.org/D43359





More information about the cfe-commits mailing list