Skip to contentSkip to conversation

x86: Fix a warning with gcc 4.4.4

PATCH New Simon Glass 3 participants 5 messages Nov 13, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Fix a warning with gcc 4.4.4

This warning appears even though it seems that the compiler could work it out. Fix it.

---

 arch/x86/cpu/cpu.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/cpu/cpu.c +1 -0
index a4e639d..3583619 100644
@@ -238,6 +238,7 @@ static void identify_cpu(struct cpu_device_id *cpu)
 	int i;
 
 	vendor_name[0] = '\0'; /* Unset */
+	cpu->device = 0; /* fix gcc 4.4.4 warning */
 
 	/* Find the id and vendor_name */
 	if (!has_cpuid()) {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#1 lore raw

PATCH 1/1 x86: Fix a warning with gcc 4.4.4

Quoted 8 lines · Simon Glass

This warning appears even though it seems that the compiler could work it out. Fix it.

---

 arch/x86/cpu/cpu.c | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-x86.

#2 lore raw

PATCH 1/1 x86: Fix a warning with gcc 4.4.4

In reply to Simon Glass
Quoted 15 lines · Simon Glass

This warning appears even though it seems that the compiler could work it out. Fix it.

---

 arch/x86/cpu/cpu.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/cpu/cpu.c +0 -0
index a4e639d..3583619 100644

arch/x86/cpu/cpu.c static void identify_cpu(struct cpu_device_id *cpu) · line 244

Quoted 7 lines
arch/x86/cpu/cpu.c +1 -0
@@ -238,6 +238,7 @@ static void identify_cpu(struct cpu_device_id *cpu)
 	int i;
 
 	vendor_name[0] = '\0'; /* Unset */
+	cpu->device = 0; /* fix gcc 4.4.4 warning */
 
 	/* Find the id and vendor_name */
 	if (!has_cpuid()) {

Do other gcc versions warn as well? 4.4 is old and worse than both 4.3 and 4.5 in many ways, so there's very little reason to be using it. If more sensible gcc versions do not warn, it's better leaving it as is to avoid real errors creeping in unnoticed.

Signature · 2 lines
M?ns Rullg?rd
mans at mansr.com
#3 lore raw

PATCH 1/1 x86: Fix a warning with gcc 4.4.4

Quoted 30 lines · M?ns Rullg?rd
Quoted 14 lines · Simon Glass

This warning appears even though it seems that the compiler could work it out. Fix it.

---

 arch/x86/cpu/cpu.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/cpu/cpu.c +0 -0
index a4e639d..3583619 100644

arch/x86/cpu/cpu.c static void identify_cpu(struct cpu_device_id *cpu)

Quoted 8 lines
arch/x86/cpu/cpu.c +1 -1
@@ -238,6 +238,7 @@ static void identify_cpu(struct cpu_device_id *cpu)
      int i;
 
      vendor_name[0] = '\0'; /* Unset */
+     cpu->device = 0; /* fix gcc 4.4.4 warning */
 
      /* Find the id and vendor_name */
      if (!has_cpuid()) {
--

Do other gcc versions warn as well? 4.4 is old and worse than both 4.3 and 4.5 in many ways, so there's very little reason to be using it. If more sensible gcc versions do not warn, it's better leaving it as is to avoid real errors creeping in unnoticed.

Quoted 1 line

--

I am using 4.7.2 which does not generate this warning.

Regards,
Bin

#4 lore raw

PATCH 1/1 x86: Fix a warning with gcc 4.4.4

Hi,

Quoted 22 lines · Bin Meng
Quoted 21 lines · M?ns Rullg?rd
Quoted 19 lines · Simon Glass

This warning appears even though it seems that the compiler could work it out. Fix it.

---

 arch/x86/cpu/cpu.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/cpu/cpu.c +1 -0
index a4e639d..3583619 100644
@@ -238,6 +238,7 @@ static void identify_cpu(struct cpu_device_id *cpu)
      int i;
 
      vendor_name[0] = '\0'; /* Unset */
+     cpu->device = 0; /* fix gcc 4.4.4 warning */
 
Quoted 9 lines
Quoted 9 lines

arch/x86/cpu/cpu.c static void identify_cpu(struct cpu_device_id *cpu)

Quoted 3 lines
arch/x86/cpu/cpu.c +0 -1
      /* Find the id and vendor_name */
      if (!has_cpuid()) {
--

Do other gcc versions warn as well? 4.4 is old and worse than both 4.3 and 4.5 in many ways, so there's very little reason to be using it. If more sensible gcc versions do not warn, it's better leaving it as is to avoid real errors creeping in unnoticed.

That gcc is only 5 years old and this is the only such problem in U-Boot so I'd like to fix it.

Quoted 3 lines
Quoted 1 line

--

I am using 4.7.2 which does not generate this warning.

4.8.2 doesn't either.

Regards,
Simon