Skip to contentSkip to conversation

s390x/intercept: Fix problem with bad compiler warning

PATCH In review Thomas Huth 5 participants 8 messages Jun 27, 2017 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x/intercept: Fix problem with bad compiler warning

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +1 -1
index 9766289..9fe86cf 100644
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 10 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +0 -0
index 9766289..9fe86cf 100644

s390x/intercept.c static void test_stap(void) · line 114

Quoted 8 lines
s390x/intercept.c +1 -1
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Whatever you prefer.

Signature · 3 lines
Thanks,

David
#2 lore raw
Quoted 36 lines · David Hildenbrand
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 15 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +1 -1
index 9766289..9fe86cf 100644
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
Quoted 7 lines

s390x/intercept.c static void test_stap(void) · line 114

Quoted 3 lines
s390x/intercept.c +0 -0
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Whatever you prefer.

True ... maybe Drew and Laurent can also comment on whether they like -Wextra or not ... if we all agree, then we can remove it, otherwise let's try to go with this patch first (in the hope that we won't hit the next problem too soon).

Quoted 1 line

Thanks!

Thomas

#3 lore raw
Quoted 43 lines · Thomas Huth
Quoted 42 lines · David Hildenbrand
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 10 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +0 -0
index 9766289..9fe86cf 100644

s390x/intercept.c static void test_stap(void) · line 114

Quoted 8 lines
s390x/intercept.c +1 -1
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Quoted 6 lines
Quoted 1 line

Whatever you prefer.

True ... maybe Drew and Laurent can also comment on whether they like -Wextra or not ... if we all agree, then we can remove it, otherwise let's try to go with this patch first (in the hope that we won't hit the next problem too soon).

I like -Wextra :)

My opinion is more checking we have, less error we have. The extra cost of adding some initializers is nothing. But we can consider this as details, so do as you want...

Thanks,
Laurent

#4 lore raw
Quoted 46 lines · Laurent Vivier
Quoted 45 lines · Thomas Huth
Quoted 43 lines · David Hildenbrand
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 10 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +0 -0
index 9766289..9fe86cf 100644

s390x/intercept.c static void test_stap(void) · line 114

Quoted 8 lines
s390x/intercept.c +1 -1
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Whatever you prefer.

Quoted 8 lines
Quoted 4 lines

True ... maybe Drew and Laurent can also comment on whether they like -Wextra or not ... if we all agree, then we can remove it, otherwise let's try to go with this patch first (in the hope that we won't hit the next problem too soon).

I like -Wextra :)

My opinion is more checking we have, less error we have.

The problem is that -Wextra often produces unfounded or even wrong warnings, like in this case. I'd prefer to add the individual parameters that rather always make sense instead, like -Wtype-limits for example.

Thomas

#5 lore raw
Quoted 52 lines · Thomas Huth
Quoted 51 lines · Laurent Vivier
Quoted 49 lines · Thomas Huth
Quoted 36 lines · David Hildenbrand
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 15 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +1 -1
index 9766289..9fe86cf 100644
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
Quoted 7 lines

s390x/intercept.c static void test_stap(void) · line 114

Quoted 3 lines
s390x/intercept.c +0 -0
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Whatever you prefer.

True ... maybe Drew and Laurent can also comment on whether they like -Wextra or not ... if we all agree, then we can remove it, otherwise let's try to go with this patch first (in the hope that we won't hit the next problem too soon).

Quoted 7 lines
Quoted 3 lines

I like -Wextra :)

My opinion is more checking we have, less error we have.

The problem is that -Wextra often produces unfounded or even wrong warnings, like in this case. I'd prefer to add the individual parameters that rather always make sense instead, like -Wtype-limits for example.

I agree, removing -Wextra and adding individual parameters seems to be a good solution.

Laurent

#6 lore raw
Quoted 55 lines · Laurent Vivier
Quoted 54 lines · Thomas Huth
Quoted 53 lines · Laurent Vivier
Quoted 43 lines · Thomas Huth
Quoted 42 lines · David Hildenbrand
Quoted 9 lines · Thomas Huth

The intercept test currently can not be compiled with GCC 4.8 anymore. It generates the following warning (which is fatal due to -Werror):

s390x/intercept.c: In function ‘test_stidp’:
s390x/intercept.c:111:9: error: missing initializer for field ‘version’ of ‘struct cpuid’ [-Werror=missing-field-initializers]

  struct cpuid id = {};
         ^

Fix it by using a "0" as intializer here.

Quoted 8 lines

---
NB: We could also remove the -Wextra from the CFLAGS instead. IMHO using -Wextra together with -Werror is just like playing Russian roulette. Since -Wextra is some kind of "compiler warning playground" for the GCC folks, you never know which compiler version will trigger an unexpected (and often also unfounded) warning here, so using this together with -Werror is just a nuisance.

I agree, this is really not deterministic.

Quoted 10 lines
 s390x/intercept.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/intercept.c +0 -0
index 9766289..9fe86cf 100644

s390x/intercept.c static void test_stap(void) · line 114

Quoted 8 lines
s390x/intercept.c +1 -1
@@ -108,7 +108,7 @@ static void test_stap(void)
 /* Test the STORE CPU ID instruction */
 static void test_stidp(void)
 {
-	struct cpuid id = {};
+	struct cpuid id = { 0 };
 
 	asm volatile ("stidp %0\n" : "+Q"(id));
 	report("type set", id.type);

arm and powerpc also use -Wextra, maybe we should remove this then for all.

Quoted 6 lines
Quoted 1 line

Whatever you prefer.

True ... maybe Drew and Laurent can also comment on whether they like -Wextra or not ... if we all agree, then we can remove it, otherwise let's try to go with this patch first (in the hope that we won't hit the next problem too soon).

I like -Wextra :)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

My opinion is more checking we have, less error we have.

The problem is that -Wextra often produces unfounded or even wrong warnings, like in this case. I'd prefer to add the individual parameters that rather always make sense instead, like -Wtype-limits for example.

I agree, removing -Wextra and adding individual parameters seems to be a good solution.

Fine by me. I'll happily review whatever somebody posts :-)

Thanks,
drew

maintainer
#7 lore raw
Quoted 6 lines · Andrew Jones
Quoted 5 lines
Quoted 3 lines

The problem is that -Wextra often produces unfounded or even wrong warnings, like in this case. I'd prefer to add the individual parameters that rather always make sense instead, like -Wtype-limits for example.

I agree, removing -Wextra and adding individual parameters seems to be a good solution.

Fine by me. I'll happily review whatever somebody posts :-)

And I'll happily apply a patch that just removes -Wextra in the meanwhile. :)

Paolo