tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Avoiding #define uint8_t (and similar) in stdint.h



I think I have discussed this issue with some folks here (apb? christos?)
some time ago, but I can't find any traces of the discussion right now -
so let me try to start from scratch:

We have this strange construct in <stdint.h>:

#ifndef uint8_t
typedef __uint8_t       uint8_t;
#define uint8_t         __uint8_t
#endif

... and repeat for all other types.

AFAICT this is standard conformant and all fine, however it leads to tricky
failures in some C++ pkgs, so we have ugly (and not upstreamable) patches
for example in www/firefox.

I can not recall why we do the double bounce, but one way to avoid the
different names would be:

#define uint8_t uint8_t

IIRC special macro expansion rules make this a valid construct and it probably
can not break valid C++ code.

Another option would be to remove the #ifdef dance alltogether and just risk
duplicate (but identical) typedefs, using the compiler predefined defines:

typedef __UINT8_TYPE__ uint8_t;


I would go for the second options. What do others think? Should we get this
fixed now and pull up to -7 in time?

Martin



Home | Main Index | Thread Index | Old Index