47 lines · c
1// RUN: %clang_cc1 -triple m68k-unknown-unknown -mrtd -std=c89 -verify -verify=rtd %s2// RUN: %clang_cc1 -triple m68k-unknown-unknown -std=c89 -verify -verify=nortd %s3 4// rtd-error@+2 {{function with no prototype cannot use the m68k_rtd calling convention}}5void foo(int arg) {6 bar(arg);7}8 9// nortd-note@+4 {{previous declaration is here}}10// nortd-error@+4 {{function declared 'm68k_rtd' here was previously declared without calling convention}}11// nortd-note@+4 {{previous declaration is here}}12// nortd-error@+4 {{function declared 'm68k_rtd' here was previously declared without calling convention}}13void nonvariadic1(int a, int b, int c);14void __attribute__((m68k_rtd)) nonvariadic1(int a, int b, int c);15void nonvariadic2(int a, int b, int c);16void __attribute__((m68k_rtd)) nonvariadic2(int a, int b, int c) { }17 18// expected-error@+2 {{variadic function cannot use m68k_rtd calling convention}}19void variadic(int a, ...);20void __attribute__((m68k_rtd)) variadic(int a, ...);21 22// rtd-note@+2 {{previous declaration is here}}23// rtd-error@+2 {{redeclaration of 'a' with a different type: 'void ((*))(int, int) __attribute__((cdecl))' vs 'void (*)(int, int) __attribute__((m68k_rtd))'}}24extern void (*a)(int, int);25__attribute__((cdecl)) extern void (*a)(int, int);26 27extern void (*b)(int, ...);28__attribute__((cdecl)) extern void (*b)(int, ...);29 30// nortd-note@+2 {{previous declaration is here}}31// nortd-error@+2 {{redeclaration of 'c' with a different type: 'void ((*))(int, int) __attribute__((m68k_rtd))' vs 'void (*)(int, int)'}}32extern void (*c)(int, int);33__attribute__((m68k_rtd)) extern void (*c)(int, int);34 35// expected-error@+2 {{variadic function cannot use m68k_rtd calling convention}}36extern void (*d)(int, ...);37__attribute__((m68k_rtd)) extern void (*d)(int, ...);38 39// expected-warning@+1 {{'m68k_rtd' only applies to function types; type here is 'int'}}40__attribute__((m68k_rtd)) static int g = 0;41 42// expected-error@+1 {{'m68k_rtd' attribute takes no arguments}}43void __attribute__((m68k_rtd("invalid"))) z(int a);44 45// expected-error@+1 {{function with no prototype cannot use the m68k_rtd calling convention}}46void __attribute__((m68k_rtd)) e();47