diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-09-24 17:49:24 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-09-24 17:49:24 +0000 |
commit | 2e0717e129b0de854b16ac6ff7398462ac89cf37 (patch) | |
tree | 09513707d77749198e97de735afbeebcd6b32fc9 /clang/test/Sema | |
parent | f2fce1492092b5ca5f9a5aef5d41841860af8b8b (diff) | |
download | bcm5719-llvm-2e0717e129b0de854b16ac6ff7398462ac89cf37.tar.gz bcm5719-llvm-2e0717e129b0de854b16ac6ff7398462ac89cf37.zip |
Downgrade error about stdcall decls with no prototype to a warning
Fixes PR21027. The MIDL compiler produces code that does this.
If we wanted to improve the warning, I think we could do this:
void __stdcall f(); // Don't warn without -Wstrict-prototypes.
void g() {
f(); // Might warn, the user probably meant for f to take no args.
f(1, 2, 3); // Warn, we have no idea what args f takes.
f(1); // Error, this is insane, one of these calls is broken.
}
Reviewers: thakis
Differential Revision: http://reviews.llvm.org/D5481
llvm-svn: 218394
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/callingconv.c | 2 | ||||
-rw-r--r-- | clang/test/Sema/decl-microsoft-call-conv.c | 14 | ||||
-rw-r--r-- | clang/test/Sema/stdcall-fastcall.c | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/clang/test/Sema/callingconv.c b/clang/test/Sema/callingconv.c index f9fa9fef2b3..68908152ff6 100644 --- a/clang/test/Sema/callingconv.c +++ b/clang/test/Sema/callingconv.c @@ -10,7 +10,7 @@ void __attribute__((stdcall)) bar(float *a) { void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}} } -void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}} +void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use the callee-cleanup fastcall calling convention}} } void __attribute__((fastcall)) test1(void) { diff --git a/clang/test/Sema/decl-microsoft-call-conv.c b/clang/test/Sema/decl-microsoft-call-conv.c index 3ec4d5ebea0..c35e77f9221 100644 --- a/clang/test/Sema/decl-microsoft-call-conv.c +++ b/clang/test/Sema/decl-microsoft-call-conv.c @@ -12,10 +12,10 @@ void __thiscall CrcGenerateTableThiscall() {} void __pascal CrcGenerateTablePascal(void); void __pascal CrcGenerateTablePascal() {} -void __fastcall CrcGenerateTableNoProtoFastcall() {} // expected-error{{function with no prototype cannot use fastcall calling convention}} -void __stdcall CrcGenerateTableNoProtoStdcall() {} // expected-error{{function with no prototype cannot use stdcall calling convention}} -void __thiscall CrcGenerateTableNoProtoThiscall() {} // expected-error{{function with no prototype cannot use thiscall calling convention}} -void __pascal CrcGenerateTableNoProtoPascal() {} // expected-error{{function with no prototype cannot use pascal calling convention}} +void __fastcall CrcGenerateTableNoProtoFastcall() {} // expected-error{{function with no prototype cannot use the callee-cleanup fastcall calling convention}} +void __stdcall CrcGenerateTableNoProtoStdcall() {} // expected-warning{{function with no prototype cannot use the callee-cleanup stdcall calling convention}} +void __thiscall CrcGenerateTableNoProtoThiscall() {} // expected-error{{function with no prototype cannot use the callee-cleanup thiscall calling convention}} +void __pascal CrcGenerateTableNoProtoPascal() {} // expected-error{{function with no prototype cannot use the callee-cleanup pascal calling convention}} // Regular calling convention is fine. void CrcGenerateTableNoProto() {} @@ -23,7 +23,7 @@ void CrcGenerateTableNoProto() {} // In system headers, the stdcall version should be a warning. # 1 "fake_system_header.h" 1 3 4 -void __fastcall SystemHeaderFastcall() {} // expected-error{{function with no prototype cannot use fastcall calling convention}} +void __fastcall SystemHeaderFastcall() {} // expected-error{{function with no prototype cannot use the callee-cleanup fastcall calling convention}} void __stdcall SystemHeaderStdcall() {} -void __thiscall SystemHeaderThiscall() {} // expected-error{{function with no prototype cannot use thiscall calling convention}} -void __pascal SystemHeaderPascal() {} // expected-error{{function with no prototype cannot use pascal calling convention}} +void __thiscall SystemHeaderThiscall() {} // expected-error{{function with no prototype cannot use the callee-cleanup thiscall calling convention}} +void __pascal SystemHeaderPascal() {} // expected-error{{function with no prototype cannot use the callee-cleanup pascal calling convention}} diff --git a/clang/test/Sema/stdcall-fastcall.c b/clang/test/Sema/stdcall-fastcall.c index 90429327a7b..e19b1102b26 100644 --- a/clang/test/Sema/stdcall-fastcall.c +++ b/clang/test/Sema/stdcall-fastcall.c @@ -6,7 +6,7 @@ int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies // Different CC qualifiers are not compatible void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{fastcall and stdcall attributes are not compatible}} -void __attribute__((stdcall)) foo4(); // expected-note{{previous declaration is here}} expected-error{{function with no prototype cannot use stdcall calling convention}} +void __attribute__((stdcall)) foo4(); // expected-note{{previous declaration is here}} expected-warning{{function with no prototype cannot use the callee-cleanup stdcall calling convention}} void __attribute__((fastcall)) foo4(void); // expected-error{{function declared 'fastcall' here was previously declared 'stdcall'}} // rdar://8876096 |