- UNICODE set correctly
- Fixed path to pcre.lib; use external library directories
- Removed several unnecessary and redundant flags from projects
Thank you for your help, XhmikosR!
Currently the information severity messages are outputted as error
messages with Severity::Information. This causes constant confusion
as people think it as mildest error severity (and rightfully so).
When it was meant to be for printing messages about the checking
procedure itself (like missing header files etc).
So I'm adding a new function for the ErrorLogger for printing these
informative messages. This makes clear the distinction of errors
found from the code and messages related to the checking itself.
It also makes it easier for clients to handle these separately.
It is easier to maintain PRO files when we keep all the console-
build specific general options in one file. For example changes to
compiler options affect to all console builds.
Updated VS9 solution
New VS10 solution that builds cppcheck into a dll used by cli and testrunner.
Functional changes and advantages of new solution:
- Share code between testrunner and cli; ability to share code with gui as well (not yet implemented)
- Files of /lib are no longer compiled twice (should improve build time on single core machines)
- Added configuration for building with PCRE support
- Executables are build into /bin (/bin/debug in debug mode) folder (Should no longer require rebuild when switching between debug and release)
- Completely x64 compatible (contains also x64-debug configuration now)
- removed unused function CheckOther::concatNames
- Replaced one indendation counter by Token::link() in checkother.cpp
- Forward declaration of Settings in threadexecutor.h
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
- Passed string parameters as const references
- Give correct string size to WinAPI functions (they take the number of characters, not the size in bytes (as used two times) and not the size in bytes plus 1 (as used one time))
- Fixed compiler warning C4293 by hiding the code for 32bit systems
- store result of wcslen(ffd.cFileName) instead of calculating it twice
- Enhanced performance by directly iterating through the token list instead of index access
- Added more allocation functions
- Simplified code
Replaced avoidable strlen call in cppcheckexecutor.cpp
- Fixed#3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
The GNU standard for long command line options is --option=value.
All other long options of cppcheck support this, so add it for
the template option, too.
--template xxx can be made obsolete later.
Should the documentation and tests also be changed now?
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Keep a list of already seen directories.
The "udev" project f.e. has a directory with
a subdirectory that contains a symbolic link
back to the parent directory.
This is ment to be used for debugging false positive errors in Cppcheck.
Current implementation tries two alternatives. Without all headers or with all headers and prints out the option with
less code. In future versions this could try with individual headers or group of header files.
The "ExtraVersion" can be used for things like Git commit Id,
release tag (version control), release date etc. If the string
is empty, nothing is printed.
New help text emphasizes we are ignoring/excluding source files.
The header files (include via source files) are not touched.
Ticket: #2965 (CLI: need better description for -i option (applies only to source files))
Filename exclusion (with -i) works only for the source files.
Print a warning if user tries to exclude header file. The warning
instructs user to use --suppress for ignoring warnings from the
header files.
Initially I added logic that checked if excluded path was a file
we would accept. This works for source files, but when file with
"unknown" extension was given it was determined as a directory
name and ending slash was added. E.g. -ifile.h would end up
having ignored path file.h/.
This commit adds per-platform checks if the path points to the
file and if the file also exists.
We don't want to keep these deprecated options for ever. So lets
print a clear warning for the users and give also specific release
number when they will be removed. Users have a plenty of time to
update their scripts and environments before removal.
Ticket: #2515 (Print warning for deprecated command line options)
When user wants to see only errors printed (--quiet in CLI) we
must obey that. And not print unmatchedSuppressions list.
Ticket: #2895 (Cannot suppress unmatchedSuppression reports)
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.
Also the recent commit (6d858b6) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.
This is admittedly a hack. But it allow us to build all modules
again.
Unify usage and API of CppCheck class. Allow only one file checked
at a time, instead of list of files. Clients can then handle file
lists more naturally and as they see fit. Also clients have better
knowledge of how checking status should be handled.
The single-threaded CLI checking was only one using the file list.
Other clients were giving files (to list) one file at a time.
When doing single-threaded checking give checked files to Cppcheck
class one file at a time. Like GUI and multithreaded checking
already do. This unifies how we call Cppcheck class from different
clients.
The source files for the class library "TinyXML" will only be included into
the build of the command line interface if the library "PCRE" was found before.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
The support for check rules will be automatically included in the generated
software if build settings were accordingly selected for PCRE.
https://sourceforge.net/apps/trac/cppcheck/ticket/2679
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Fixes#2656 (-i Give path to ignore does not ignore if start of the
path is different than checked path)
Simplify paths given as -i options. This makes it easier to match
the paths as simplifying removes redundant parts.
Ticket #2686 (regression/bug in path handling)
There are situations that paths given to command line can contain
quotation marks. In normal situations shell removes them. For
these cases they don't get removed add code to check paths from
quotation marks and remove them.
Non-existing include path is not a fatal problem requiring exiting
the program. Instead we just print a warning and remove the non-
existing include path from the list.
This expands the CLI exclude feature to also allow excluding
filenames (with paths). When filename with recognized extension
is given to -i option then matching filenames (with paths) are
ignored when checking.
Ticket #2538 (Allow excluding files from the checking)
Only match full directory names as parts of whole paths. So -isrc
matches src/file.cpp and proj/src/file.cpp. But does not match
mysrc/file.cpp or proj/srcfiles/file.cpp.