I found the bug in uVision v5 1. add a segment of code #ifdef XYZ ... #endif
2. make sure there is no preprocessor symbol XYZ 3. save all and rebuild 4. check code size 5. edit preprocessor symbol, add XYZ 6. click BUILD (F7) -> keil figured out that you changed compile options and it's doing what looks like a rebuild and not only build of changed files (showing that it's compiling all c files in project) 7. check code size, it's same as without symbol, the whole block of txt between ifdef XYZ and endif is NOT compiled?!?! - BUG 8. click REBUILD -> the code is now built, the codesize increased
so the rebuild done from build in step6 does not properly work, it's a serious bug :(
You've informed keil support about it?