This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: stdint definitions
- From: Sergei Gavrikov <sergei dot gavrikov at gmail dot com>
- To: Manuel Borchers <manuel at matronix dot de>
- Cc: Ecos Discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 4 Aug 2010 17:28:03 +0300 (EEST)
- Subject: Re: [ECOS] stdint definitions
- References: <1280912794.2595.22.camel@netxaccos>
On Wed, 4 Aug 2010, Manuel Borchers wrote:
Hi all,
I stumbled accros a wired problem today:
I need the ISO standard types uint32_t and the like. So, I found
stdint.h in the uSTL package. Pulled that one into my config, I get a
collision of the definitions with sys/bsdtypes.h (because I'm using the
OpenBSD network stack at the same time) when building the lib/app that
uses stdint.h. For example:
install/include/sys/bsdtypes.h:37: error: redefinition of typedef âint16_tâ
install/include/stdint.h:109: error: previous declaration of âint16_tâ was here
I found a statement in the archieves from 2007[1] that the bsdtypes
defines should be replaces with somthing "better". I checked both files
and for me the definitions are the same, so that seems to have happened.
Any ideas why the compiler complains here?
Hi Manuel,
One way to manage this do not tweaking the header's sources is to use
preprocessor.
such a collision
typedef int i32_t;
typedef int i32_t;
can be "hidden" as
#define i32_t XXX_i32_t
typedef int i32_t;
#undef i32_t
typedef int i32_t;
So, hack/trick would be (not tested)
#define HAVE_STDINT_H 1
#if HAVE_STDINT_H
#define int8_t BSD_int8_t
...
#define uint64_t BSD_u64_t
#include <sys/bsdtypes.h>
#undef int8_t
...
#undef uint64_t
#else
#include <sys/bsdtypes.h>
#endif
#include <stdint.h>
If the fist header is included is 'stdint.h' then you can revert the
"hiding".
HTH
Sergei
Cheers,
Manuel
[1] http://sourceware.org/ml/ecos-discuss/2007-01/msg00171.html
--
Manuel Borchers
Web: http://www.matronix.de
eMail: manuel@matronix.de
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss