Skip to contentSkip to conversation

Bugfix: offsetof in klibc

DISCUSSION Hannes Reinecke 3 participants 4 messages Feb 3, 2004 – Feb 12, 2004

lore
Share & tools
lore
#0 lore raw

Hi all, hpa,

there is a small typo in stddef.h:offsetof()

=== stddef.h 1.1 vs edited ==--- 1.1/klibc/klibc/include/stddef.h Wed Oct 22 19:37:29 2003
+++ edited/stddef.h Tue Feb 3 10:16:15 2004
@@ -19,6 +19,6 @@
#endif

#undef offsetof
-#define offsetof(t,m) ((size_t)&((t *)0->m))
+#define offsetof(t,m) ((size_t)&((t *)0)->m)

  #endif /* _STDDEF_H */

otherwise the compiler complains and I suspect it will generated invalid code anyway.

Cheers,

Hannes

Signature · 15 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 15 lines · Hannes Reinecke

Hi all, hpa,

there is a small typo in stddef.h:offsetof()

=== stddef.h 1.1 vs edited ==> --- 1.1/klibc/klibc/include/stddef.h Wed Oct 22 19:37:29 2003
+++ edited/stddef.h Tue Feb 3 10:16:15 2004

(quoted diff) +1 -1
@@ -19,6 +19,6 @@
 #endif
 
 #undef offsetof
-#define offsetof(t,m) ((size_t)&((t *)0->m))
+#define offsetof(t,m) ((size_t)&((t *)0)->m)
 
 #endif /* _STDDEF_H */
Quoted 2 lines

otherwise the compiler complains and I suspect it will generated invalid code anyway.

Don't you mean to send this to the klibc mailing list?

thanks,

greg k-h

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Hannes Reinecke
Quoted 14 lines · Greg KH
Quoted 13 lines · Hannes Reinecke

Hi all, hpa,

there is a small typo in stddef.h:offsetof()

=== stddef.h 1.1 vs edited ==> > --- 1.1/klibc/klibc/include/stddef.h Wed Oct 22 19:37:29 2003
+++ edited/stddef.h Tue Feb 3 10:16:15 2004

(quoted diff) +1 -1
@@ -19,6 +19,6 @@
 #endif
 
 #undef offsetof
-#define offsetof(t,m) ((size_t)&((t *)0->m))
+#define offsetof(t,m) ((size_t)&((t *)0)->m)
 
Quoted 6 lines
Quoted 4 lines
(quoted diff) +0 -0
 #endif /* _STDDEF_H */

otherwise the compiler complains and I suspect it will generated invalid code anyway.

Don't you mean to send this to the klibc mailing list?

We are using offsetof() now, with the private data db patch :) So we have to fix it too, until klibc is fixed.

Kay

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Hannes Reinecke
Quoted 17 lines · Kay Sievers
Quoted 16 lines · Greg KH
Quoted 15 lines · Hannes Reinecke

Hi all, hpa,

there is a small typo in stddef.h:offsetof()

=== stddef.h 1.1 vs edited ==> > > --- 1.1/klibc/klibc/include/stddef.h Wed Oct 22 19:37:29 2003
+++ edited/stddef.h Tue Feb 3 10:16:15 2004

(quoted diff) +1 -1
@@ -19,6 +19,6 @@
 #endif
 
 #undef offsetof
-#define offsetof(t,m) ((size_t)&((t *)0->m))
+#define offsetof(t,m) ((size_t)&((t *)0)->m)
 
 #endif /* _STDDEF_H */
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

otherwise the compiler complains and I suspect it will generated invalid code anyway.

Don't you mean to send this to the klibc mailing list?

We are using offsetof() now, with the private data db patch :) So we have to fix it too, until klibc is fixed.

Good point. I fixed our version of it for now.

thanks,

greg k-h

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel