154db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s
254db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman
354db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman// CC qualifier can be applied only to functions
454db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanint __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies to function types; type here is 'int'}}
554db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanint __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies to function types; type here is 'int'}}
654db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman
754db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman// Different CC qualifiers are not compatible
854db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid __attribute__((stdcall, fastcall)) foo3(void); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
954db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid __attribute__((stdcall)) foo4(); // expected-warning{{calling convention 'stdcall' ignored for this target}}
1054db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid __attribute__((fastcall)) foo4(void); // expected-warning {{calling convention 'fastcall' ignored for this target}}
1154db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman
1254db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballman// rdar://8876096
1354db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo1(int i, int j) __attribute__((fastcall, cdecl)); // expected-warning{{calling convention 'fastcall' ignored for this target}}
1454db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo2(int i, int j) __attribute__((fastcall, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
1554db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo3(int i, int j) __attribute__((fastcall, regparm(2))); // expected-warning {{calling convention 'fastcall' ignored for this target}}
1654db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo4(int i, int j) __attribute__((stdcall, cdecl)); // expected-warning{{calling convention 'stdcall' ignored for this target}}
1754db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo5(int i, int j) __attribute__((stdcall, fastcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
1854db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo6(int i, int j) __attribute__((cdecl, fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}
1954db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo7(int i, int j) __attribute__((cdecl, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}}
2054db3244f425dae51cde7c6298ec42d0764f8ed8Aaron Ballmanvoid rdar8876096foo8(int i, int j) __attribute__((regparm(2), fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}
21