Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 31 additions & 0 deletions clang/test/CheckedC/checked-scope/variadic-functions-macos.c
Original file line number Diff line number Diff line change
@@ -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<const char>), ...);
int MyPrintf(const char *format : itype(_Nt_array_ptr<const char>), ...)
__attribute__((format(printf, 1, 2)));

int scanf(const char *format : itype(_Nt_array_ptr<const char>), ...);
int MyScanf(const char *format : itype(_Nt_array_ptr<const char>), ...)
__attribute__((format(scanf, 1, 2)));

void f1 (_Nt_array_ptr<char> 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'}}
}
}
7 changes: 3 additions & 4 deletions clang/test/CheckedC/checked-scope/variadic-functions-win.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion clang/test/CheckedC/parsing/invalid-where-clause.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ void invalid_cases_nullstmt(_Nt_array_ptr<char> 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}}
Expand Down