Skip to contentSkip to conversation

Renames variable to fix shadow warning.

PATCH Superseded Leonardo Brás 4 participants 8 messages Oct 17, 2018 – Oct 18, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 Renames variable to fix shadow warning.

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +2 -2
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 		int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
-		const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+		const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
 			GET_LE(&sym->st_name);
 
 		for (k = 0; k < NSYMS; k++) {
-			if (!strcmp(name, required_syms[k].name)) {
+			if (!strcmp(name2, required_syms[k].name)) {
 				if (syms[k]) {
 					fail("duplicate symbol %s\n",
 					     required_syms[k].name);
Signature · 1 line
2.19.1
#1 lore raw

Hi Leonardo,

Thanks for the patch, just some small comments below.

Please, check previous log messages with git log arch/x86/entry/vdso/vdso2c.h, you will see that most patches had the prefix "x86/vdso:" in the commit message.

Quoted 13 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 97

Quoted 6 lines
arch/x86/entry/vdso/vdso2c.h +1 -1
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 		int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;
-		const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+		const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
 			GET_LE(&sym->st_name);

Could you please use a more meaningful name instead of name2 please? I believe sym_name should be fine.

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len,

Quoted 8 lines
arch/x86/entry/vdso/vdso2c.h +1 -1
 		for (k = 0; k < NSYMS; k++) {
-			if (!strcmp(name, required_syms[k].name)) {
+			if (!strcmp(name2, required_syms[k].name)) {
 				if (syms[k]) {
 					fail("duplicate symbol %s\n",
 					     required_syms[k].name);
 

Regards
Helen

#2 lore raw

Hello Helen,
Thanks for the suggestions!

Quoted 8 lines · Helen Koike

Hi Leonardo,

Thanks for the patch, just some small comments below.

Please, check previous log messages with git log arch/x86/entry/vdso/vdso2c.h, you will see that most patches had the prefix "x86/vdso:" in the commit message.

Ok, added! This change will be available on v2.

Quoted 10 lines · Leonardo Brás
Quoted 8 lines

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 97

Quoted 11 lines
arch/x86/entry/vdso/vdso2c.h +1 -1
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
              int k;
              ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
                      GET_LE(&symtab_hdr->sh_entsize) * i;
-             const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+             const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
                      GET_LE(&sym->st_name);

Could you please use a more meaningful name instead of name2 please? I believe sym_name should be fine.

Ok, I renamed as you suggested.
Also, I renamed the "name" variable to "image_name" as Andy suggested. This change will be available on v2.

Quoted 10 lines

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len,

Quoted 9 lines
arch/x86/entry/vdso/vdso2c.h +1 -1
              for (k = 0; k < NSYMS; k++) {
-                     if (!strcmp(name, required_syms[k].name)) {
+                     if (!strcmp(name2, required_syms[k].name)) {
                              if (syms[k]) {
                                      fail("duplicate symbol %s\n",
                                           required_syms[k].name);
 
Quoted 2 lines

Regards
Helen

Regards,
Leonardo Bras

#3 lore raw
In reply to Leonardo Brás
Quoted 16 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
 		int k;
 		ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
 			GET_LE(&symtab_hdr->sh_entsize) * i;

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 103

Quoted 10 lines
arch/x86/entry/vdso/vdso2c.h +2 -2
-		const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+		const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
 			GET_LE(&sym->st_name);
 
 		for (k = 0; k < NSYMS; k++) {
-			if (!strcmp(name, required_syms[k].name)) {
+			if (!strcmp(name2, required_syms[k].name)) {
 				if (syms[k]) {
 					fail("duplicate symbol %s\n",
 					     required_syms[k].name);

NAK.

Please read and understand the code and rename both variables to meaningful names, not just a mindless name/name2 ...

Thanks,

Ingo

maintainer
#4 lore raw
Quoted 33 lines · Ingo Molnar
Quoted 16 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
              int k;
              ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
                      GET_LE(&symtab_hdr->sh_entsize) * i;

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 103

Quoted 10 lines
arch/x86/entry/vdso/vdso2c.h +2 -2
-             const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+             const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
                      GET_LE(&sym->st_name);
 
              for (k = 0; k < NSYMS; k++) {
-                     if (!strcmp(name, required_syms[k].name)) {
+                     if (!strcmp(name2, required_syms[k].name)) {
                              if (syms[k]) {
                                      fail("duplicate symbol %s\n",
                                           required_syms[k].name);

NAK.

Quoted 3 lines

Please read and understand the code and rename both variables to meaningful names, not just a mindless name/name2 ...

Maybe image_name and sym_name?

--Andy

#5 lore raw

Hello Andy,
Thanks for the suggestion.
I renamed them as suggested and it will be available on v2.

Regards,

Leonardo

Quoted 42 lines · Andy Lutomirski
Quoted 33 lines · Ingo Molnar
Quoted 16 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
              int k;
              ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
                      GET_LE(&symtab_hdr->sh_entsize) * i;

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 103

Quoted 10 lines
arch/x86/entry/vdso/vdso2c.h +2 -2
-             const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+             const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
                      GET_LE(&sym->st_name);
 
              for (k = 0; k < NSYMS; k++) {
-                     if (!strcmp(name, required_syms[k].name)) {
+                     if (!strcmp(name2, required_syms[k].name)) {
                              if (syms[k]) {
                                      fail("duplicate symbol %s\n",
                                           required_syms[k].name);

NAK.

Quoted 3 lines

Please read and understand the code and rename both variables to meaningful names, not just a mindless name/name2 ...

Maybe image_name and sym_name?

--Andy

#6 lore raw
In reply to Ingo Molnar

Thanks Ingo,

Quoted 33 lines · Ingo Molnar
Quoted 16 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
              int k;
              ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
                      GET_LE(&symtab_hdr->sh_entsize) * i;

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 103

Quoted 10 lines
arch/x86/entry/vdso/vdso2c.h +2 -2
-             const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+             const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
                      GET_LE(&sym->st_name);
 
              for (k = 0; k < NSYMS; k++) {
-                     if (!strcmp(name, required_syms[k].name)) {
+                     if (!strcmp(name2, required_syms[k].name)) {
                              if (syms[k]) {
                                      fail("duplicate symbol %s\n",
                                           required_syms[k].name);

NAK.

Quoted 3 lines

Please read and understand the code and rename both variables to meaningful names, not just a mindless name/name2 ...

It's changed! This change will be available on v2.

Quoted 3 lines

Thanks,

Ingo

Regards,
Leonardo

#7 lore raw
Quoted 35 lines · Leonardo Bras

Thanks Ingo,

Quoted 33 lines · Ingo Molnar
Quoted 16 lines · Leonardo Brás

Renames the char variable to avoid shadowing a variable previously declared on this function.

---
 arch/x86/entry/vdso/vdso2c.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/vdso2c.h +0 -0
index fa847a620f40..9466998d0f28 100644
@@ -93,11 +93,11 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
              int k;
              ELF(Sym) *sym = raw_addr + GET_LE(&symtab_hdr->sh_offset) +
                      GET_LE(&symtab_hdr->sh_entsize) * i;

arch/x86/entry/vdso/vdso2c.h static void BITSFUNC(go)(void *raw_addr, size_t raw_len, · line 103

Quoted 10 lines
arch/x86/entry/vdso/vdso2c.h +2 -2
-             const char *name = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
+             const char *name2 = raw_addr + GET_LE(&strtab_hdr->sh_offset) +
                      GET_LE(&sym->st_name);
 
              for (k = 0; k < NSYMS; k++) {
-                     if (!strcmp(name, required_syms[k].name)) {
+                     if (!strcmp(name2, required_syms[k].name)) {
                              if (syms[k]) {
                                      fail("duplicate symbol %s\n",
                                           required_syms[k].name);

NAK.

Quoted 5 lines
Quoted 3 lines

Please read and understand the code and rename both variables to meaningful names, not just a mindless name/name2 ...

It's changed! This change will be available on v2.

Thanks!

Ingo