Bug 59747 - mbuf.h declares variables, breaks with g++
Summary: mbuf.h declares variables, breaks with g++
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: eCos
Classification: Retired
Component: TCPIP
Version: 1.5.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: eCos bugs internal list
QA Contact: eCos bugs internal list
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-02-12 16:57 UTC by Andrew Lunn
Modified: 2007-04-18 16:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-02-12 19:34:09 UTC
Embargoed:


Attachments (Terms of Use)
This patch seems to fix it for us. Its not had much testing..... (3.81 KB, patch)
2002-02-12 18:41 UTC, Andrew Lunn
no flags Details | Diff

Description Andrew Lunn 2002-02-12 16:57:58 UTC
Description of Problem:

We are interfacing to the TCP/IP stack with our powerline code. Powerline is
effectlivly an ethernet device. We are doing some reimplementation work and
moving some of the code from C to C++. This is now causing a problem because g++
compiling C code does something different to what gcc does when compiling C
code.  We need the file mbuf.h for some of the definitions that are in it. We
tell g++ to compile this bit with C semantics since its a C header file. The
header file declares some variables (bad idea). gcc marks these variables as
common, aka 'C' according to nm. g++ makes them unintialised data, aka 'B' in
nm. The linker can handle multiple 'C' variables and it discards all but one.
Multiple 'B' variables is cannot handle. Reading
http://gcc.gnu.org/ml/gcc/1999-05n/msg00511.html
suggests this is the correct thing to do.... 

So, mbuf.h need to be hacked so that it does not declare variables......

Version-Release number of selected component (if applicable): 1.5.2

Comment 1 Andrew Lunn 2002-02-12 18:41:55 UTC
Created attachment 45420 [details]
This patch seems to fix it for us. Its not had much testing.....

Comment 2 Martin Buck 2002-02-12 19:34:04 UTC
Looks like Andrew mixed up declaration and definition very consistently (even in the patch) :-)
So everywhere you read "declaration" above, it should be "definition" and vice versa.


Comment 3 Jonathan Larmour 2002-02-13 10:34:06 UTC
I've applied something pretty similar to your patch, so it should show up in
future releases.



Comment 4 Martin Buck 2002-03-20 11:56:40 UTC
Jonathan,

your change isn't visible in the public eCos CVS yet, so I can't check what exactly you applied. Andrew's patch added "#endif __ECOS" both in 
include/sys/mbuf.h and src/sys/kern/uipc_mbuf.c and gcc 3 complains about that. If you applied that patch directly, could change it to either just 
"#endif" or to "#endif /* __ECOS */"?


Comment 5 Jonathan Larmour 2002-03-20 16:25:45 UTC
Yep, don't worry. I had already caught that :-).



Note You need to log in before you can comment on or make changes to this bug.