Skip to contentSkip to conversation

common: env_common: make env_get_char_spec __weak

PATCH New Jeroen Hofstee 4 participants 7 messages Jul 10, 2014 – Jul 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: env_common: make env_get_char_spec __weak

---
yup another clang warning:

common/env_common.c:30:14: warning: unused function '__env_get_char_spec' [-Wunused-function] static uchar __env_get_char_spec(int index)

             ^
---
 common/env_common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
common/env_common.c +1 -3
index cd7b4cd..3b979bc 100644
@@ -27,12 +27,10 @@ struct hsearch_data env_htab = {
 	.change_ok = env_flags_validate,
 };
 
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)
 {
 	return *((uchar *)(gd->env_addr + index));
 }
-uchar env_get_char_spec(int)
-	__attribute__((weak, alias("__env_get_char_spec")));
 
 static uchar env_get_char_init(int index)
 {
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 common: env_common: make env_get_char_spec __weak

Hi Jeroen,

Quoted 18 lines · Jeroen Hofstee

---
yup another clang warning:

common/env_common.c:30:14: warning: unused function '__env_get_char_spec' [-Wunused-function] static uchar __env_get_char_spec(int index)

              ^
---
  common/env_common.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
common/env_common.c +0 -0
index cd7b4cd..3b979bc 100644
@@ -27,12 +27,10 @@ struct hsearch_data env_htab = {
  	.change_ok = env_flags_validate,
  };
 

common/env_common.c struct hsearch_data env_htab = { · line 36

Quoted 10 lines
common/env_common.c +1 -3
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)
  {
  	return *((uchar *)(gd->env_addr + index));
  }
-uchar env_get_char_spec(int)
-	__attribute__((weak, alias("__env_get_char_spec")));
 
  static uchar env_get_char_init(int index)
  {

signed-off is missing?

Regards,
Jeroen

#2 lore raw

PATCH 1/1 common: env_common: make env_get_char_spec __weak

In reply to Jeroen Hofstee

Dear Jeroen,

common/env_common.c struct hsearch_data env_htab = { · line 30

Quoted 3 lines · In message <[email protected]> you wrote:
common/env_common.c +1 -1
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)

__weak static ... ?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Experience is what causes a person to make new  mistakes  instead  of
old ones.
#3 lore raw

PATCH 1/1 common: env_common: make env_get_char_spec __weak

Hello Wolfgang,

Quoted 7 lines · Wolfgang Denk

Dear Jeroen,

common/env_common.c struct hsearch_data env_htab = { · line 30

Quoted 3 lines · In message <[email protected]> you wrote:
common/env_common.c +1 -1
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)

__weak static ... ?

tempting huh, but it is the patch format with tricks you in thinking that. The weak is actually added to the function without the leading underscores, a couple of lines below (which wasn't static and shouldn't become so).

Regards,
Jeroen

#4 lore raw

PATCH 1/1 common: env_common: make env_get_char_spec __weak

Dear Jeroen Hofstee,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 4 lines

common/env_common.c struct hsearch_data env_htab = { · line 30

Quoted 3 lines
common/env_common.c +1 -1
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)

__weak static ... ?

tempting huh, but it is the patch format with tricks you in thinking that. The weak is actually added to the function without the leading underscores, a couple of lines below (which wasn't static and shouldn't become so).

Argh. You are right.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Sometimes, too long is too long.                          - Joe Crowe
#5 lore raw

PATCH v2 1/1 common: env_common: make env_get_char_spec __weak

In reply to Jeroen Hofstee

---
yup another clang warning:

common/env_common.c:30:14: warning: unused function '__env_get_char_spec' [-Wunused-function] static uchar __env_get_char_spec(int index)

             ^

changes since v1:
add missing S-O-B line

---
 common/env_common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
common/env_common.c +1 -3
index cd7b4cd..3b979bc 100644
@@ -27,12 +27,10 @@ struct hsearch_data env_htab = {
 	.change_ok = env_flags_validate,
 };
 
-static uchar __env_get_char_spec(int index)
+__weak uchar env_get_char_spec(int index)
 {
 	return *((uchar *)(gd->env_addr + index));
 }
-uchar env_get_char_spec(int)
-	__attribute__((weak, alias("__env_get_char_spec")));
 
 static uchar env_get_char_init(int index)
 {
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH v2 1/1 common: env_common: make env_get_char_spec __weak

Quoted 1 line · Jeroen Hofstee

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140721/d5d91eef/attachment.pgp>