llvm-project/clang/test/Sema/heinous-extensions-on.c
Aaron Ballman c505ce9df7
Deprecate -fheinous-gnu-extensions; introduce a new warning flag (#105821)
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.
2024-08-23 15:38:21 -04:00

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}}
}