Daniel Marjamäki
Daniel Marjamäki
only handles known values for now.. @pfultz2 do you have some feedback. I don't know this code well..
This makes the code more portable. you can use the same code both on a pc and on a embedded system. if you do not like to use uint8_t and...
Reported in the cppcheck forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/9c0ae79e38/?limit=25 Example code: ``` int main() { char* ptr = 0; #line 16 "main.sc" { #line 12 "main.sc" struct sqlexd sqlstm; } #line 16 "main.sc"...
Code inside `#if 0` should be skipped: ``` #if 0 ' #endif ``` simplecpp output: `1.c:2: syntax error: No pair for character ('). Can't process file. File is either invalid...
Reported here: https://sourceforge.net/p/cppcheck/discussion/development/thread/c101b0d84d/ expressions in `#if` might be evaluated wrongly. Example #if ((0x7fffffffffffffffL * 2UL) < 0) # error LOL #endif simplecpp output: $ ./simplecpp 1.c 1.c:2: #error: #error LOL
Input: ``` #define COUNTER_NAME(NAME, ...) NAME##Count #define COMMA , #define DECLARE_COUNTERS(LIST) unsigned long LIST(COUNTER_NAME, COMMA); #define ACTUAL_LIST(FUNCTION, SEPARATOR) \ FUNCTION(event1, int, foo) SEPARATOR \ FUNCTION(event2, char, bar) DECLARE_COUNTERS(ACTUAL_LIST) ``` Output...
The #line can confuse sameline(): ``` #line 1 abc ``` The directive is written on line 1 and so is "abc" and therefore sameline() thinks they are written on the...
Example code: #define MAC2STR(x) x[0],x[1],x[2],x[3],x[4],x[5] #define FT_DEBUG(fmt, args...) if(pGlobalCtx && pGlobalCtx->debug_level>=2) printf("FT-dbg: "fmt, ##args) FT_DEBUG(" %02x:%02x:%02x:%02x:%02x:%02x\n", MAC2STR(pCtx->wlan_intf_addr[i])); Simplecpp does not preprocess this code properly. The MAC2STR is not expanded.
First reported in Cppcheck trac here: https://trac.cppcheck.net/ticket/9538 Code: ``` #define at(x, y) x##y #define b(...) \ aa(__VA_ARGS__, , , , , , , , , , , , , ,...