danmar / simplecpp

C++ preprocessor
BSD Zero Clause License
209 stars 83 forks source link

avoid some redundant checks in `TokenList::readfile()` #324

Closed firewave closed 1 year ago

firewave commented 1 year ago

calling isspace() is unnecessary since we handle all non-ASCII characters and already have special handling of all remaining whitespaces according to https://en.cppreference.com/w/cpp/string/byte/isspace.

Runinng with -q -D__GNUC__ -Ilib lib/valueflow.cpp

Clang 16 276,826,655 -> 270,642,840 GCC 13 283,762,095-> 280,179,302

firewave commented 1 year ago

I filed/updated several tickets about issues I discovered because of this: https://github.com/llvm/llvm-project/issues/67824 https://trac.cppcheck.net/ticket/7510 https://trac.cppcheck.net/ticket/12023 https://trac.cppcheck.net/ticket/12024 https://trac.cppcheck.net/ticket/12025