Use sizeof(gd_t), not sizeof(struct global_data)
PATCH 1/1 Use sizeof(gd_t), not sizeof(struct global_data)
The eNET (x86) build fails with "invalid application of 'sizeof' to incomplete type 'struct global_data'" because x86 doesn't define struct global_data. Change sizeof(struct global_data) to sizeof(gd_t) which is always available.
--- lib/asm-offsets.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/asm-offsets.c +1 -1
@@ -23,7 +23,7 @@ int main(void) {/* Round up to make sure size gives nice stack alignment */ DEFINE (GENERATED_GBL_DATA_SIZE , - (sizeof (struct global_data )+15 ) & ~15 ); + (sizeof (gd_t)+15 ) & ~15 );return 0 ; }
Signature · 1 line
1.7.2.3
PATCH 1/1 Use sizeof(gd_t), not sizeof(struct global_data)
Quoted 4 lines · Lo?c Minier
The eNET (x86) build fails with "invalid application of 'sizeof' to incomplete type 'struct
global_data'" because x86 doesn't define structglobal_data. ?Changesizeof(struct global_data)tosizeof(gd_t)which is always available.
why not change x86's global_data.h to define the struct ? all other arches define 'struct global_data'.
-mike
PATCH 1/1 Use sizeof(gd_t), not sizeof(struct global_data)
Quoted 2 lines · Mike Frysinger
why not change x86's
global_data.hto define the struct ? all other arches define 'structglobal_data'.
We could implement both fixes; there are two reasons I preferred sending this fix instead of the one you mention:
* gd_t is used across the tree, while struct global_data is only used in arch/*/include/asm/global_data.h headers
* the global_data.h header suggested that sizeof(gd_t) was an acceptable construct in a comment:
GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
I'll send an additional patch to also add struct global_data to arch/i386/include/asm/global_data.h.
Signature · 1 line
Lo?c Minier
PATCH 1/1 Use sizeof(gd_t), not sizeof(struct global_data)
In reply to Loïc MinierDear =?UTF-8?q?Lo=C3=AFc=20Minier?=,
Quoted 4 lines · In message <[email protected]> you wrote:
The eNET (x86) build fails with "invalid application of 'sizeof' to incomplete type 'struct
global_data'" because x86 doesn't define structglobal_data. Changesizeof(struct global_data)tosizeof(gd_t)which is always available.
Um... I do not like this change; the resulting code is harder to read.
Can you please change the struct declaration isntead, like this:
arch/i386/include/asm/global_data.h +1 -1
@@ -35,7 +35,7 @@ #ifndef __ASSEMBLY__ -typedef struct { +typedef struct global_data { bd_t *bd; unsigned long flags; unsigned long baudrate;
Best regards,
Wolfgang Denk
Signature · 7 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 "Athens built the Acropolis. Corinth was a commercial city, interested in purely materialistic things. Today we admire Athens, visit it, preserve the old temples, yet we hardly ever set foot in Corinth." - Dr. Harold Urey, Nobel Laureate in chemistry
PATCH 1/1 Use sizeof(gd_t), not sizeof(struct global_data)
Quoted 1 line · Wolfgang Denk
Um... I do not like this change; the resulting code is harder to read.
I don't mind either way; I had asked <[email protected]> which one was the preferred approach, but didn't get comments on this particular point; see <[email protected]> for the rationale for picking this option rather than the other one.
I've sent a second patch to also define struct global_data; feel free to cherry pick any of the two patches or both
Thanks!
Signature · 1 line
Lo?c Minier
PATCH 2/2 i386: Define struct global_data as on other arches
In reply to Loïc MinierThe eNET (x86) build was failing to build with "invalid application of 'sizeof' to incomplete type 'struct global_data'" because x86 didn't define struct global_data. lib/asm-offsets.c was changed to use sizeof(gd_t) as gd_t is more commonly used outside of arch/*/include/asm/global_data.h, but it is still useful to define struct global_data in arch/i386/include/asm/global_data.h for consistency.
--- arch/i386/include/asm/global_data.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/i386/include/asm/global_data.h +1 -1
@@ -35,7 +35,7 @@ #ifndef __ASSEMBLY__ -typedef struct { +typedef struct global_data { bd_t *bd; unsigned long flags; unsigned long baudrate;
Signature · 1 line
1.7.2.3