#14173: Add Valuetype type and sign for stdint macros#7869
#14173: Add Valuetype type and sign for stdint macros#7869danmar merged 1 commit intodanmar:mainfrom
Conversation
e1bf2a5 to
7a1ea72
Compare
|
Still needs a ticket and we should also file a follow-up about |
7a1ea72 to
cf8ae54
Compare
| valuetype.type = ValueType::Type::CHAR; | ||
| else if (macroWidth == 16) | ||
| valuetype.type = ValueType::Type::SHORT; | ||
| else if (macroWidth == 32) |
There was a problem hiding this comment.
you need to compare the platform sizes. An int can be 16 bits.
There was a problem hiding this comment.
We should probably put the logic into platform.cpp so it can be re-used.
I also found the "ticket" - it's the extensive list in a TODO in Platform::getLimitsDefines().
There was a problem hiding this comment.
The actual ticket: https://trac.cppcheck.net/ticket/11928#comment:4.
There was a problem hiding this comment.
We could also just generate defines which would simplify the code. Here's the compiler output for reference (the macros will be mapped to the non-reserved ones in the headers):
$ clang++ -dM -E - < /dev/null | grep _C\(
#define __INT16_C(c) c
#define __INT32_C(c) c
#define __INT64_C(c) c##L
#define __INT8_C(c) c
#define __INTMAX_C(c) c##L
#define __UINT16_C(c) c
#define __UINT32_C(c) c##U
#define __UINT64_C(c) c##UL
#define __UINT8_C(c) c
#define __UINTMAX_C(c) c##UL
There was a problem hiding this comment.
We should probably put the logic into platform.cpp so it can be re-used.
hmm if we put it in platform.cpp then that file must include symboldatabase.h :-(
how about putting it in ValueType instead the symboldatabase already has a Settings dependency anyway.
There was a problem hiding this comment.
We could also just generate defines which would simplify the code. Here's the compiler output for reference (the macros will be mapped to the non-reserved ones in the headers):
I don't want to reuse those macros they will make it impossible to implement the Misra C rules. The code INT8_C(1000) would be preprocessed into 1000..
|
yes a ticket is needed. 👍 @firewave for your information I asked swasti to implement this and my motivation is that we need it for misra c. it would have been nice to replace |
53a1a31 to
690fa50
Compare
690fa50 to
876563b
Compare
876563b to
62c30ad
Compare
|



No description provided.