Bug 59747 - mbuf.h declares variables, breaks with g++
mbuf.h declares variables, breaks with g++
Status: CLOSED CURRENTRELEASE
Product: eCos
Classification: Retired
Component: TCPIP (Show other bugs)
1.5.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: eCos bugs internal list
eCos bugs internal list
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-12 11:57 EST by Andrew Lunn
Modified: 2007-04-18 12:40 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-02-12 14:34:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Andrew Lunn 2002-02-12 11:57:58 EST
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 13:41:55 EST
Created attachment 45420 [details]
This patch seems to fix it for us. Its not had much testing.....
Comment 2 Martin Buck 2002-02-12 14:34:04 EST
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 05:34:06 EST
I've applied something pretty similar to your patch, so it should show up in
future releases.

Comment 4 Martin Buck 2002-03-20 06:56:40 EST
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 11:25:45 EST
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.