CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
49 lines
2.6 KiB
C
49 lines
2.6 KiB
C
// RUN: %clang_cc1 -std=c99 -Wmissing-field-initializers -Wmissing-braces -verify %s
|
|
|
|
// Tests that using {0} in struct initialization or assignment is supported
|
|
struct foo { int x; int y; };
|
|
struct bar { struct foo a; struct foo b; };
|
|
struct A { int a; };
|
|
struct B { struct A a; };
|
|
struct C { struct B b; };
|
|
struct D { struct C c; int n; };
|
|
struct E { short e; };
|
|
struct F { struct E e; int n; };
|
|
|
|
int main(void)
|
|
{
|
|
struct foo f = { 0 }; // no-warning
|
|
struct foo g = { 9 }; // expected-warning {{missing field 'y' initializer}}
|
|
struct foo h = { 9, 9 }; // no-warning
|
|
struct bar i = { 0 }; // no-warning
|
|
struct bar j = { 0, 0 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'b' initializer}}
|
|
struct bar k = { { 9, 9 }, { 9, 9 } }; // no-warning
|
|
struct bar l = { { 9, 9 }, { 0 } }; // no-warning
|
|
struct bar m = { { 0 }, { 0 } }; // no-warning
|
|
struct bar n = { { 0 }, { 9, 9 } }; // no-warning
|
|
struct bar o = { { 9 }, { 9, 9 } }; // expected-warning {{missing field 'y' initializer}}
|
|
struct C p = { 0 }; // no-warning
|
|
struct C q = { 9 }; // warning suppressed for struct with single element
|
|
struct D r = { 9 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'n' initializer}}
|
|
struct F s = { 0 }; // no-warning
|
|
struct F t = { 9 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'n' initializer}}
|
|
|
|
f = (struct foo ) { 0 }; // no-warning
|
|
g = (struct foo ) { 9 }; // expected-warning {{missing field 'y' initializer}}
|
|
h = (struct foo ) { 9, 9 }; // no-warning
|
|
i = (struct bar) { 0 }; // no-warning
|
|
j = (struct bar) { 0, 0 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'b' initializer}}
|
|
k = (struct bar) { { 9, 9 }, { 9, 9 } }; // no-warning
|
|
l = (struct bar) { { 9, 9 }, { 0 } }; // no-warning
|
|
m = (struct bar) { { 0 }, { 0 } }; // no-warning
|
|
n = (struct bar) { { 0 }, { 9, 9 } }; // no-warning
|
|
o = (struct bar) { { 9 }, { 9, 9 } }; // expected-warning {{missing field 'y' initializer}}
|
|
p = (struct C) { 0 }; // no-warning
|
|
q = (struct C) { 9 }; // warning suppressed for struct with single element
|
|
r = (struct D) { 9 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'n' initializer}}
|
|
s = (struct F) { 0 }; // no-warning
|
|
t = (struct F) { 9 }; // expected-warning {{suggest braces around initialization of subobject}} expected-warning {{missing field 'n' initializer}}
|
|
|
|
return 0;
|
|
}
|