mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 00:26:06 +00:00

The new warning flag is `-Winvalid-gnu-asm-cast`, which is enabled by default and is a downgradable diagnostic which defaults to an error. This language dialect flag only controls whether a single diagnostic is emitted as a warning or as an error, and has never been expanded to include other behaviors. Given the rather perjorative name, it's better for us to just expose a diagnostic flag for the one warning in question and let the user elect to do `-Wno-error=` if they need to. There's not a lot of use of the language dialect flag in the wild, but there is some use of it. For the time being, this aliases the -f flag to `-Wno-error=invalid-gnu-asm-cast`, but the -f flag can eventually be removed.
10 lines
363 B
C
10 lines
363 B
C
// RUN: %clang_cc1 %s -verify -Wno-error=invalid-gnu-asm-cast
|
|
|
|
void foo(void) {
|
|
int a;
|
|
// PR3788
|
|
asm("nop" : : "m"((int)(a))); // expected-warning {{invalid use of a cast in an inline asm context requiring an lvalue}}
|
|
// PR3794
|
|
asm("nop" : "=r"((unsigned)a)); // expected-warning {{invalid use of a cast in an inline asm context requiring an lvalue}}
|
|
}
|