diff --git a/clang/test/CheckedC/checked-scope/variadic-functions-non-win.c b/clang/test/CheckedC/checked-scope/variadic-functions-linux.c similarity index 85% rename from clang/test/CheckedC/checked-scope/variadic-functions-non-win.c rename to clang/test/CheckedC/checked-scope/variadic-functions-linux.c index f1983819200a..62a76bfda9d8 100644 --- a/clang/test/CheckedC/checked-scope/variadic-functions-non-win.c +++ b/clang/test/CheckedC/checked-scope/variadic-functions-linux.c @@ -1,10 +1,9 @@ -// UNSUPPORTED: system-windows +// UNSUPPORTED: !linux // Test calls to variadic functions in checked scopes. -// Some -Wformat error messages are different between linux and windows -// systems. This file contains non-windows-specific tests. The windows tests -// are in variadic-functions-win.c and the common tests are in -// variadic-functions.c. +// Some -Wformat error messages are different between Linux, Windows, +// and MacOS. This file contains Linux specific tests. The common +// tests are in variadic-functions.c. // RUN: %clang_cc1 -fcheckedc-extension -verify \ // RUN: -verify-ignore-unexpected=note %s diff --git a/clang/test/CheckedC/checked-scope/variadic-functions-macos.c b/clang/test/CheckedC/checked-scope/variadic-functions-macos.c new file mode 100644 index 000000000000..39e1fda4ce14 --- /dev/null +++ b/clang/test/CheckedC/checked-scope/variadic-functions-macos.c @@ -0,0 +1,31 @@ +// UNSUPPORTED: !darwin + +// Test calls to variadic functions in checked scopes. +// Some -Wformat error messages are different between Linux, Windows +// and MacOS. This file contains MacOS specific ests. The common +// tests are in variadic-functions.c. + +// RUN: %clang_cc1 -fcheckedc-extension -verify \ +// RUN: -verify-ignore-unexpected=note %s + +int printf(const char *format : itype(_Nt_array_ptr), ...); +int MyPrintf(const char *format : itype(_Nt_array_ptr), ...) + __attribute__((format(printf, 1, 2))); + +int scanf(const char *format : itype(_Nt_array_ptr), ...); +int MyScanf(const char *format : itype(_Nt_array_ptr), ...) + __attribute__((format(scanf, 1, 2))); + +void f1 (_Nt_array_ptr p) { +_Checked { + printf("%Z", p); // expected-error {{invalid conversion specifier 'Z'}} + MyPrintf("%Z", p); // expected-error {{invalid conversion specifier 'Z'}} + scanf("%Z", p); // expected-error {{invalid conversion specifier 'Z'}} + MyScanf("%Z", p); // expected-error {{invalid conversion specifier 'Z'}} + + printf("%Li", (long long) 42); // expected-error {{length modifier 'L' results in undefined behavior or no effect with 'i' conversion specifier}} + MyPrintf("%Li", (long long) 42); // expected-error {{length modifier 'L' results in undefined behavior or no effect with 'i' conversion specifier}} + scanf("%Li", (long long) 42); // expected-error {{length modifier 'L' results in undefined behavior or no effect with 'i' conversion specifier}} expected-error {{format specifies type 'long long *' but the argument has type 'long long'}} + MyScanf("%Li", (long long) 42); // expected-error {{length modifier 'L' results in undefined behavior or no effect with 'i' conversion specifier}} expected-error {{format specifies type 'long long *' but the argument has type 'long long'}} +} +} diff --git a/clang/test/CheckedC/checked-scope/variadic-functions-win.c b/clang/test/CheckedC/checked-scope/variadic-functions-win.c index 78ccfce7db78..702095823570 100644 --- a/clang/test/CheckedC/checked-scope/variadic-functions-win.c +++ b/clang/test/CheckedC/checked-scope/variadic-functions-win.c @@ -1,10 +1,9 @@ // UNSUPPORTED: !windows // Test calls to variadic functions in checked scopes. -// Some -Wformat error messages are different between linux and windows -// systems. This file contains windows-specific tests. The non-windows tests -// are in variadic-functions-non-win.c and the common tests are in -// variadic-functions.c. +// Some -Wformat error messages are different between Linux, Windows, +// and MacOS. This file contains windows-specific tests. The common +// tests are in variadic-functions.c. // RUN: %clang_cc1 -fcheckedc-extension -verify \ // RUN: -verify-ignore-unexpected=note %s diff --git a/clang/test/CheckedC/parsing/invalid-where-clause.c b/clang/test/CheckedC/parsing/invalid-where-clause.c index 9014217fa6ec..3fdf0978a018 100644 --- a/clang/test/CheckedC/parsing/invalid-where-clause.c +++ b/clang/test/CheckedC/parsing/invalid-where-clause.c @@ -17,7 +17,6 @@ void invalid_cases_nullstmt(_Nt_array_ptr p, int a, int b) { _Where p : ; // expected-error {{expected bounds expression}} _Where p : count(x); // expected-error {{use of undeclared identifier 'x'}} _Where q : count(0); // expected-error {{use of undeclared identifier q}} - _Where (); // expected-error {{expected bounds declaration or equality expression in where clause}} _Where a = 0; // expected-error {{expected comparison operator in equality expression}} _Where a == 1 _And a; // expected-error {{invalid expression in where clause, expected bounds declaration or equality expression}} _Where a _And a == 1; // expected-error {{invalid expression in where clause, expected bounds declaration or equality expression}}