Skip to contentSkip to conversation

meson: add -Wno-missing-braces

PATCH In review Ser, Simon 4 participants 8 messages Mar 20, 2019 – Mar 21, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Ser, Simon

author
#0 lore raw

PATCH 1/1 meson: add -Wno-missing-braces

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 557400a5..bb100b75 100644
@@ -38,6 +38,7 @@ cc_args = [
 	'-Wno-type-limits',
 	'-Wno-unused-parameter',
 	'-Wno-unused-result',
+	'-Wno-missing-braces',
 	'-Werror=address',
 	'-Werror=array-bounds',
@@ -45,7 +46,6 @@ cc_args = [
 	'-Werror=init-self',
 	'-Werror=int-to-pointer-cast',
 	'-Werror=main',
-	'-Werror=missing-braces',
 	'-Werror=nonnull',
 	'-Werror=pointer-to-int-cast',
 	'-Werror=return-type',
Signature · 15 lines
2.21.0
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw
Quoted 10 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Arguably the above initializer should be written as simply {} instead of having the 0 value for initializing the first member which happens to be a substruct.

BR,
Jani.

Quoted 24 lines
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 557400a5..bb100b75 100644
@@ -38,6 +38,7 @@ cc_args = [
 	'-Wno-type-limits',
 	'-Wno-unused-parameter',
 	'-Wno-unused-result',
+	'-Wno-missing-braces',
 	'-Werror=address',
 	'-Werror=array-bounds',
@@ -45,7 +46,6 @@ cc_args = [
 	'-Werror=init-self',
 	'-Werror=int-to-pointer-cast',
 	'-Werror=main',
-	'-Werror=missing-braces',
 	'-Werror=nonnull',
 	'-Werror=pointer-to-int-cast',
 	'-Werror=return-type',
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
author
#2 lore raw
Quoted 12 lines · Jani Nikula
Quoted 10 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

Quoted 8 lines

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Arguably the above initializer should be written as simply {} instead of
having the 0 value for initializing the first member which happens to be
a substruct.

Unfortunately using {} is a GNU extension, and ISO C forbids empty initializer lists.

Does IGT use un-standardized extensions?

Quoted 19 lines

BR,
Jani.

Quoted 15 lines
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -0
index 557400a5..bb100b75 100644
@@ -38,6 +38,7 @@ cc_args = [
 	'-Wno-type-limits',
 	'-Wno-unused-parameter',
 	'-Wno-unused-result',
+	'-Wno-missing-braces',
 	'-Werror=address',
 	'-Werror=array-bounds',
Quoted 8 lines

meson.build cc_args = [ · line 51

Quoted 8 lines
meson.build +0 -1
@@ -45,7 +46,6 @@ cc_args = [
 	'-Werror=init-self',
 	'-Werror=int-to-pointer-cast',
 	'-Werror=main',
-	'-Werror=missing-braces',
 	'-Werror=nonnull',
 	'-Werror=pointer-to-int-cast',
 	'-Werror=return-type',

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw
Quoted 16 lines · Simon
Quoted 15 lines · Jani Nikula
Quoted 10 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Quoted 8 lines
Quoted 5 lines

Arguably the above initializer should be written as simply {} instead of
having the 0 value for initializing the first member which happens to be
a substruct.

Unfortunately using {} is a GNU extension, and ISO C forbids empty initializer lists.

Right, it's also okay in ISO C++11.

Quoted 1 line

Does IGT use un-standardized extensions?

I'm pretty sure it does, but I'll defer decisions about this to the IGT maintainers.

BR,
Jani.

Quoted 28 lines
Quoted 28 lines

BR,
Jani.

Quoted 23 lines
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 557400a5..bb100b75 100644
@@ -38,6 +38,7 @@ cc_args = [
 	'-Wno-type-limits',
 	'-Wno-unused-parameter',
 	'-Wno-unused-result',
+	'-Wno-missing-braces',
 	'-Werror=address',
 	'-Werror=array-bounds',
@@ -45,7 +46,6 @@ cc_args = [
 	'-Werror=init-self',
 	'-Werror=int-to-pointer-cast',
 	'-Werror=main',
-	'-Werror=missing-braces',
 	'-Werror=nonnull',
 	'-Werror=pointer-to-int-cast',
 	'-Werror=return-type',
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw
Quoted 26 lines · Jani Nikula
Quoted 16 lines · Simon
Quoted 15 lines · Jani Nikula
Quoted 10 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Quoted 8 lines
Quoted 5 lines

Arguably the above initializer should be written as simply {} instead of
having the 0 value for initializing the first member which happens to be
a substruct.

Unfortunately using {} is a GNU extension, and ISO C forbids empty initializer lists.

Quoted 6 lines

Right, it's also okay in ISO C++11.

Quoted 1 line

Does IGT use un-standardized extensions?

I'm pretty sure it does, but I'll defer decisions about this to the IGT maintainers.

We use -std=gnu11.

It's not as an explicit flag anywhere, making it hard to find. It's in toplevel meson.build, the project() call, default_options:
'c_std=gnu11'

A quick look in autotools reveals that we don't set the std on it at all. Oh well.

Signature · 5 lines
Petri Latvala
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
author
#5 lore raw
Quoted 41 lines · Petri Latvala
Quoted 32 lines · Jani Nikula
Quoted 27 lines · Simon
Quoted 18 lines · Jani Nikula
Quoted 9 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}
Quoted 3 lines

I don't believe there is any value in keeping this, so let's just
disable it.

I fail to come up with examples right now, but I think there are
legitimate cases for the warning.

Quoted 7 lines

Arguably the above initializer should be written as simply {} instead
of
having the 0 value for initializing the first member which happens to
be
a substruct.

Quoted 3 lines

Unfortunately using {} is a GNU extension, and ISO C forbids empty
initializer lists.

Quoted 7 lines

Right, it's also okay in ISO C++11.

Quoted 1 line

Does IGT use un-standardized extensions?

I'm pretty sure it does, but I'll defer decisions about this to the IGT
maintainers.

Quoted 6 lines

We use -std=gnu11.

It's not as an explicit flag anywhere, making it hard to find. It's in
toplevel meson.build, the project() call, default_options:
'c_std=gnu11'

All right! It's probably fine to use this extension then.

(I personally prefer to stick to ISO C and POSIX, but the project preference prevails of course!)

Quoted 2 lines

A quick look in autotools reveals that we don't set the std on it at all. Oh well.

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

author
#6 lore raw
In reply to Jani Nikula
Quoted 27 lines · Jani Nikula
Quoted 26 lines · Simon
Quoted 24 lines · Jani Nikula
Quoted 9 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}
Quoted 3 lines

I don't believe there is any value in keeping this, so let's just
disable it.

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Arguably the above initializer should be written as simply {} instead
of
having the 0 value for initializing the first member which happens to
be
a substruct.

Quoted 4 lines
Quoted 2 lines

Unfortunately using {} is a GNU extension, and ISO C forbids empty initializer lists.

Right, it's also okay in ISO C++11.

I don't know about C++, but FWIW it's forbidden in ISO C11:

Quoted 1 line

gcc -std=c11 -Wall -pedantic test.c

test.c: In function ‘main’:
test.c:7:23: warning: ISO C forbids empty initializer braces [- Wpedantic]
struct thing stuff = {};

Quoted 29 lines
Quoted 1 line

Does IGT use un-standardized extensions?

I'm pretty sure it does, but I'll defer decisions about this to the IGT
maintainers.

BR,
Jani.

Quoted 19 lines
Quoted 19 lines

BR,
Jani.

Quoted 15 lines
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -0
index 557400a5..bb100b75 100644
@@ -38,6 +38,7 @@ cc_args = [
 	'-Wno-type-limits',
 	'-Wno-unused-parameter',
 	'-Wno-unused-result',
+	'-Wno-missing-braces',
 	'-Werror=address',
 	'-Werror=array-bounds',
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

meson.build cc_args = [ · line 51

Quoted 8 lines
meson.build +0 -1
@@ -45,7 +46,6 @@ cc_args = [
 	'-Werror=init-self',
 	'-Werror=int-to-pointer-cast',
 	'-Werror=main',
-	'-Werror=missing-braces',
 	'-Werror=nonnull',
 	'-Werror=pointer-to-int-cast',
 	'-Werror=return-type',

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#7 lore raw
In reply to Ser, Simon
Quoted 22 lines · Simon
Quoted 12 lines · Jani Nikula
Quoted 10 lines · Simon

Enabling -Werror=missing-braces results in this error with Clang:

    ../tests/kms_vrr.c:203:20: error: suggest braces around
initialization of subobject [-Werror,-Wmissing-braces]
            drmVBlank vbl = { 0 };
                              ^
                              {}

I don't believe there is any value in keeping this, so let's just disable it.

Quoted 8 lines

I fail to come up with examples right now, but I think there are legitimate cases for the warning.

Arguably the above initializer should be written as simply {} instead of
having the 0 value for initializing the first member which happens to be
a substruct.

Quoted 4 lines

Unfortunately using {} is a GNU extension, and ISO C forbids empty initializer lists.

Does IGT use un-standardized extensions?

$ git grep '=[ ]*{[ ]*}' | wc -l
195
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev