32 lines · cpp
1// RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -x c -verify %s2// RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -verify=expected,cxx %s3 4#ifdef __cplusplus5extern "C" {6#endif7static int f(void) { return 42; } // cxx-warning{{unused function 'f'}}8int g(void) __attribute__((alias("f")));9 10static int foo [] = { 42, 0xDEAD };11extern typeof(foo) bar __attribute__((unused, alias("foo")));12 13static int __attribute__((overloadable)) f0(int x) { return x; } // expected-warning{{unused function 'f0'}}14static float __attribute__((overloadable)) f0(float x) { return x; } // expected-warning{{unused function 'f0'}}15int g0(void) __attribute__((alias("?f0@@YAHH@Z")));16 17#ifdef __cplusplus18/// https://github.com/llvm/llvm-project/issues/8859319/// We report a warning in C++ mode because the internal linkage `resolver` gets20/// mangled as it does not have a language linkage. GCC does not mangle21/// `resolver` or report a warning.22static int f1() { return 42; } // cxx-warning{{unused function 'f1'}}23int g1(void) __attribute__((alias("?f1@@YAHXZ")));24}25 26namespace ns {27static int f3(int) { return 42; } // cxx-warning{{unused function 'f3'}}28static int f3() { return 42; } // cxx-warning{{unused function 'f3'}}29int g3() __attribute__((alias("?f3@ns@@YAHXZ")));30}31#endif32