diff --git a/man/manual.docbook b/man/manual.docbook index 2c0e2013d..81da3fd30 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -695,6 +695,10 @@ Checking test.c... configuration files. It is available in the View menu. All settings are not documented in this manual. + If you have a question about the .cfg file + format it is recommended you ask in the forum + (http://sourceforge.net/p/cppcheck/discussion/). + The command line cppcheck will try to load custom .cfg files from the working path - execute cppcheck from the path where the .cfg files are. @@ -1118,6 +1122,23 @@ Checking minsize.c... + +
+ strz + + This setting is not used by Cppcheck currently. But with this + you can say that an argument must be a zero-terminated + string. + + <?xml version="1.0"?> +<def> + <function name="do_something"> + <arg nr="1"> + <strz/> + </arg> + </function> +</def> +
@@ -1209,11 +1230,19 @@ Checking useretval.c...
- pure + pure and const - A function that is pure will calculate a return value and has no - side effects. If the same parameters are given twice then the same - return value will be calculated twice. + These correspond to the GCC function attributes pure and + const. + + A pure function has no effects except to return a value, and its + return value depends only on the parameters and global + variables. + + A const function has no effects except to return a value, and + its return value depends only on the parameters. + + Here is an example code: void f(int x) { @@ -1224,24 +1253,29 @@ Checking useretval.c... } } - Cppcheck reports no warning + If calculate() is a const function then the + result of calculate(x) will be the same in both + conditions, since the same parameter value is used. - # cppcheck pure.c -Checking pure.c... + Cppcheck normally assumes that the result might be different, + and reports no warning for the code: - If a proper lib.cfg is provided, the + # cppcheck const.c +Checking const.c... + + If a proper const.cfg is provided, the unreachable code is detected: - # cppcheck --enable=style --library=pure pure.c -Checking pure.c... -[pure.c:7]: (style) Expression is always false because 'else if' condition matches previous condition at line 5. + # cppcheck --enable=style --library=const const.c +Checking const.c... +[const.c:7]: (style) Expression is always false because 'else if' condition matches previous condition at line 5. - Here is a minimal pure.cfg file: + Here is a minimal const.cfg file: <?xml version="1.0"?> <def> <function name="calculate"> - <pure/> + <const/> <arg nr="1"/> </function> </def>