Skip to content

Commit 32daa84

Browse files
committed
Update tests
1 parent f8e1760 commit 32daa84

19 files changed

+35
-34
lines changed

clang/test/C/C23/n2607.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void test1(void) {
2424
void test2(void) {
2525
typedef int array[1];
2626
array reg_array;
27-
const array const_array;
27+
const array const_array = { 0 };
2828

2929
// An array and its elements are identically qualified. We have to test this
3030
// using pointers to the array and element, because the controlling
@@ -50,7 +50,7 @@ void test2(void) {
5050
void test3(void) {
5151
// Validate that we pick the correct composite type for a conditional
5252
// operator in the presence of qualifiers.
53-
const int const_array[1];
53+
const int const_array[1] = { 0 };
5454
int array[1];
5555

5656
// FIXME: the type here should be `const int (*)[1]`, but for some reason,

clang/test/C/drs/dr1xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void dr124(void) {
289289
*/
290290
void dr126(void) {
291291
typedef int *IP;
292-
const IP object; /* expected-note {{variable 'object' declared const here}} */
292+
const IP object = 0; /* expected-note {{variable 'object' declared const here}} */
293293

294294
/* The root of the DR is whether 'object' is a pointer to a const int, or a
295295
* const pointer to int.
@@ -329,7 +329,7 @@ void dr129(void) {
329329
void dr131(void) {
330330
struct S {
331331
const int i; /* expected-note {{data member 'i' declared const here}} */
332-
} s1, s2;
332+
} s1 = { 0 }, s2 = { 0 };
333333
s1 = s2; /* expected-error {{cannot assign to variable 's1' with const-qualified data member 'i'}} */
334334
}
335335

clang/test/Parser/typeof.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ static void test(void) {
1212
short TInt eee; // expected-error{{expected ';' at end of declaration}}
1313
void ary[7] fff; // expected-error{{array has incomplete element type 'void'}} expected-error{{expected ';' at end of declaration}}
1414
typeof(void ary[7]) anIntError; // expected-error{{expected ')'}} expected-note {{to match this '('}} expected-error {{variable has incomplete type 'typeof(void)' (aka 'void')}}
15-
typeof(const int) aci;
16-
const typeof (*pi) aConstInt;
15+
typeof(const int) aci = 0;
16+
const typeof (*pi) aConstInt = 0;
1717
int xx;
1818
int *i;
1919
}

clang/test/Sema/assign.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ void test2 (const struct {int a;} *x) {
1111

1212
typedef int arr[10];
1313
void test3(void) {
14-
const arr b; // expected-note {{variable 'b' declared const here}}
15-
const int b2[10]; // expected-note {{variable 'b2' declared const here}}
14+
const arr b = {}; // expected-note {{variable 'b' declared const here}}
15+
const int b2[10] = {}; // expected-note {{variable 'b2' declared const here}}
1616
b[4] = 1; // expected-error {{cannot assign to variable 'b' with const-qualified type 'const arr' (aka 'const int[10]')}}
1717
b2[4] = 1; // expected-error {{cannot assign to variable 'b2' with const-qualified type 'const int[10]'}}
1818
}

clang/test/Sema/atomic-ops.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// RUN: %clang_cc1 %s -verify=expected,fp80,noi128 -fgnuc-version=4.2.1 -ffreestanding \
2-
// RUN: -fsyntax-only -triple=i686-linux-gnu -std=c11
2+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=i686-linux-gnu -std=c11
33
// RUN: %clang_cc1 %s -verify=expected,noi128 -fgnuc-version=4.2.1 -ffreestanding \
4-
// RUN: -fsyntax-only -triple=i686-linux-android -std=c11
4+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=i686-linux-android -std=c11
55
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
6-
// RUN: -fsyntax-only -triple=powerpc64-linux-gnu -std=c11
6+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=powerpc64-linux-gnu -std=c11
77
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
8-
// RUN: -fsyntax-only -triple=powerpc64-linux-gnu -std=c11 \
8+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=powerpc64-linux-gnu -std=c11 \
99
// RUN: -target-cpu pwr7
1010
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
11-
// RUN: -fsyntax-only -triple=powerpc64le-linux-gnu -std=c11 \
11+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=powerpc64le-linux-gnu -std=c11 \
1212
// RUN: -target-cpu pwr8 -DPPC64_PWR8
1313
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
14-
// RUN: -fsyntax-only -triple=powerpc64-unknown-aix -std=c11 \
14+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=powerpc64-unknown-aix -std=c11 \
1515
// RUN: -target-cpu pwr8
1616
// RUN: %clang_cc1 %s -verify -fgnuc-version=4.2.1 -ffreestanding \
17-
// RUN: -fsyntax-only -triple=powerpc64-unknown-aix -std=c11 \
17+
// RUN: -Wno-default-const-init-unsafe -fsyntax-only -triple=powerpc64-unknown-aix -std=c11 \
1818
// RUN: -mabi=quadword-atomics -target-cpu pwr8 -DPPC64_PWR8
1919

2020
// Basic parsing/Sema tests for __c11_atomic_*

clang/test/Sema/block-return.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void foo7(void)
126126
int (^JJ) (void) = ^{ return j; }; // OK
127127
int (^KK) (void) = ^{ return j+1; }; // OK
128128

129-
__block const int k;
129+
__block const int k = 0;
130130
const int cint = 100;
131131

132132
int (^MM) (void) = ^{ return k; };

clang/test/Sema/builtins-bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ unsigned invalid11(struct s *arg, int info_kind) {
6969
}
7070

7171
unsigned valid12(void) {
72-
const struct s t;
72+
const struct s t = {};
7373
return __builtin_preserve_type_info(t, 0) +
7474
__builtin_preserve_type_info(*(struct s *)0, 1);
7575
}

clang/test/Sema/builtins-elementwise-math.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 i
8888
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
8989
ext = __builtin_elementwise_add_sat(ext, ext);
9090

91-
const int ci;
91+
const int ci = 0;
9292
i = __builtin_elementwise_add_sat(ci, i);
9393
i = __builtin_elementwise_add_sat(i, ci);
9494
i = __builtin_elementwise_add_sat(ci, ci);
@@ -154,7 +154,7 @@ void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 i
154154
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
155155
ext = __builtin_elementwise_sub_sat(ext, ext);
156156

157-
const int ci;
157+
const int ci = 0;
158158
i = __builtin_elementwise_sub_sat(ci, i);
159159
i = __builtin_elementwise_sub_sat(i, ci);
160160
i = __builtin_elementwise_sub_sat(ci, ci);
@@ -214,7 +214,7 @@ void test_builtin_elementwise_max(int i, short s, double d, float4 v, int3 iv, u
214214
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
215215
ext = __builtin_elementwise_max(ext, ext);
216216

217-
const int ci;
217+
const int ci = 0;
218218
i = __builtin_elementwise_max(ci, i);
219219
i = __builtin_elementwise_max(i, ci);
220220
i = __builtin_elementwise_max(ci, ci);
@@ -274,7 +274,7 @@ void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, u
274274
_BitInt(32) ext; // expected-warning {{'_BitInt' in C17 and earlier is a Clang extension}}
275275
ext = __builtin_elementwise_min(ext, ext);
276276

277-
const int ci;
277+
const int ci = 0;
278278
i = __builtin_elementwise_min(ci, i);
279279
i = __builtin_elementwise_min(i, ci);
280280
i = __builtin_elementwise_min(ci, ci);
@@ -1070,7 +1070,7 @@ void test_builtin_elementwise_copysign(int i, short s, double d, float f, float4
10701070
ext = __builtin_elementwise_copysign(ext, ext);
10711071
// expected-error@-1 {{1st argument must be a scalar or vector of floating-point types (was '_BitInt(32)')}}
10721072

1073-
const float cf32;
1073+
const float cf32 = 0.0f;
10741074
f = __builtin_elementwise_copysign(cf32, f);
10751075
f = __builtin_elementwise_copysign(f, cf32);
10761076
f = __builtin_elementwise_copysign(cf32, f);

clang/test/Sema/builtins-overflow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void test(void) {
99
unsigned r;
1010
const char * c;
1111
float f;
12-
const unsigned q;
12+
const unsigned q = 0;
1313

1414
__builtin_add_overflow(); // expected-error {{too few arguments to function call, expected 3, have 0}}
1515
__builtin_add_overflow(1, 1, 1, 1); // expected-error {{too many arguments to function call, expected 3, have 4}}

clang/test/Sema/enable_if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ size_t strnlen(const char *s, size_t maxlen) // expected-note {{'strnlen' has be
5252

5353
void test2(const char *s, int i) {
5454
// CHECK: define {{.*}}void @test2
55-
const char c[123];
55+
const char c[123] = { 0 };
5656
strnlen(s, i);
5757
// CHECK: call {{.*}}strnlen_real1
5858
strnlen(s, 999);

0 commit comments

Comments
 (0)