mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-23 05:25:50 -04:00

After https://reviews.llvm.org/rL355317 we noticed that quite a decent amount of code redeclares builtins (memcpy in particular, I believe reduced from an MSVC header) with a calling convention specified. This gets particularly troublesome when the user specifies a new 'default' calling convention on the command line. When looking to add a diagnostic for this case, it was noticed that we had 3 other diagnostics that differed only slightly. This patch ALSO unifies those under a 'select'. Unfortunately, the order of words in ONE of these diagnostics was reversed ("'thiscall' calling convention" vs "calling convention 'thiscall'"), so this patch also standardizes on the former. Differential Revision: https://reviews.llvm.org/D59560 Change-Id: I79f99fe7c2301640755ffdd774b46eb44526bb22 llvm-svn: 356663
54 lines
2.9 KiB
C
54 lines
2.9 KiB
C
// RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
|
|
|
|
void __attribute__((fastcall)) foo(float *a) { // expected-warning {{'fastcall' calling convention ignored for this target}}
|
|
}
|
|
|
|
void __attribute__((stdcall)) bar(float *a) { // expected-warning {{'stdcall' calling convention ignored for this target}}
|
|
}
|
|
|
|
void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}}
|
|
}
|
|
|
|
void __attribute__((fastcall)) test2(int a, ...) { // expected-warning {{'fastcall' calling convention ignored for this target}}
|
|
}
|
|
void __attribute__((stdcall)) test3(int a, ...) { // expected-warning {{'stdcall' calling convention ignored for this target}}
|
|
}
|
|
void __attribute__((thiscall)) test4(int a, ...) { // expected-warning {{'thiscall' calling convention ignored for this target}}
|
|
}
|
|
|
|
void __attribute__((cdecl)) ctest0() {}
|
|
|
|
void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' attribute takes no arguments}}
|
|
|
|
void (__attribute__((fastcall)) *pfoo)(float*) = foo; // expected-warning {{'fastcall' calling convention ignored for this target}}
|
|
|
|
void (__attribute__((stdcall)) *pbar)(float*) = bar; // expected-warning {{'stdcall' calling convention ignored for this target}}
|
|
|
|
void (*pctest0)() = ctest0;
|
|
|
|
void ctest2() {}
|
|
void (__attribute__((cdecl)) *pctest2)() = ctest2;
|
|
|
|
typedef void (__attribute__((fastcall)) *Handler) (float *); // expected-warning {{'fastcall' calling convention ignored for this target}}
|
|
Handler H = foo;
|
|
|
|
int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{'pcs' attribute takes one argument}}
|
|
int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute takes one argument}}
|
|
int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute requires a string}} \
|
|
// expected-error {{invalid PCS type}}
|
|
int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires a string}}
|
|
/* These are ignored because the target is i386 and not ARM */
|
|
int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{'pcs' calling convention ignored for this target}}
|
|
int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{'pcs' calling convention ignored for this target}}
|
|
int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{invalid PCS type}}
|
|
|
|
void ctest3();
|
|
void __attribute__((cdecl)) ctest3() {}
|
|
|
|
typedef __attribute__((stdcall)) void (*PROC)(); // expected-warning {{'stdcall' calling convention ignored for this target}}
|
|
PROC __attribute__((cdecl)) ctest4(const char *x) {}
|
|
|
|
void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {} // expected-warning {{'intel_ocl_bicc' calling convention ignored for this target}}
|
|
|
|
struct type_test {} __attribute__((stdcall)); // expected-warning {{'stdcall' calling convention ignored for this target}} expected-warning {{'stdcall' attribute only applies to functions and methods}}
|