03/16/2011 11:02 AM
stdint.h / compiler_gnu.h
We've had some problems running third party analysis tools over our code.
In particular, the QNX headers are defining all the stdint types (uint16_t, uint32_t etc) as int and applying attributes
to define the size.
typedef int _GCC_ATTR_ALIGN_16t __attribute__((__mode__(__HI__)));
typedef _GCC_ATTR_ALIGN_16t _Int16t __attribute__((__aligned__(2)));
typedef _Int16t int16_t;typedef int _GCC_ATTR_ALIGN_32t;
typedef _GCC_ATTR_ALIGN_32t _Int32t __attribute__((__aligned__(4)));
typedef _Int32t int32_t;
The tools don't recognise the attributes and hence see all these types as identical which can causes issues with
overloading and potentially misses cases of truncation.
This seems to be peculiar to qcc? Is there a particular reason why QNX went down this (non standard) route.
Is there any way to make these types distinct within the standard interpreation of C source code?