Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for _Nt_checked array initializer sizes #429

Merged
merged 1 commit into from
Nov 17, 2020
Merged
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
3 changes: 2 additions & 1 deletion tests/static_checking/initializers.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ void f12 (void) {
char string_literal_initializer_with_braces nt_checked[] = {"abcde"};
char string_literal_initializer_with_braces_empty nt_checked[] = {};
char string_literal_initializer_too_long nt_checked[3] = "abcde"; // expected-warning {{initializer-string for char array is too long}} expected-error {{initializer-string for _Nt_checked char array is too long}}
char string_literal_initializer_too_long2 nt_checked[1] = "a"; // expected-error {{initializer-string for _Nt_checked char array is too long}}
char string_literal_initializer_by_chars nt_checked[6] = {'a', 'b', 'c', 'd', 'e', '\0'};
char string_literal_initializer_by_chars2 nt_checked[5] = {'a', '\0'};
char string_literal_initializer_by_chars_no_null_term nt_checked[6] = {'a', 'b', 'c', 'd', 'e', 'f'}; // expected-error {{null terminator expected in _Nt_checked array initializer}}
Expand All @@ -406,4 +407,4 @@ void f12 (void) {
ListChecker list2 = {{1,2,3,4,0}};
ListChecker list3 = {{1,2,3,4}}; // expected-error {{null terminator expected in _Nt_checked array initializer}}
int integer_array_checker nt_checked[] = {1, 2, 3, 4, 0};
}
}