From e3ae14c22c5227c9d857d59095b27162ee9b592c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:58:30 +0100 Subject: [PATCH 1/4] Fix #12225 Improve documentation of --library in the manual --- man/manual.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/man/manual.md b/man/manual.md index b0a9a6088f4..c4983969a90 100644 --- a/man/manual.md +++ b/man/manual.md @@ -954,9 +954,63 @@ This allows you to create and manage multiple configuration files for different # Library configuration -When external libraries are used, such as WinAPI, POSIX, gtk, Qt, etc, Cppcheck doesn't know how the external functions behave. Cppcheck then fails to detect various problems such as memory leaks, buffer overflows, possible null pointer dereferences, etc. But this can be fixed with configuration files. - -Cppcheck already contains configurations for several libraries. They can be loaded as described below. Note that the configuration for the standard libraries of C and C++, std.cfg, is always loaded by cppcheck. If you create or update a configuration file for a popular library, we would appreciate if you upload it to us. +When external libraries are used, such as WinAPI, POSIX, gtk, Qt, etc, Cppcheck has no information about functions, types, or macros contained in those libraries. Cppcheck then fails to detect various problems in the code, or might even abort the analysis. But this can be fixed by using the appropriate configuration files. + +Cppcheck already contains configurations for several libraries. They can be loaded as described below. Note that the configuration for the standard libraries of C and C++, std.cfg, is always loaded by cppcheck. If you create or update a configuration file for a popular library, we would appreciate if you supply it to the cppcheck project. + +## Using a .cfg file + +To use a .cfg file shipped with cppcheck, pass the `--library=` option. The table below shows the existing libraries: +| .cfg file | Library | Comment | +| ------------- | ------------- | ------------- | +| avr.cfg | | | +| bento4.cfg | | +| boost.cfg | | +| bsd.cfg | | +| cairo.cfg | | +| cppcheck-lib.cfg | | +| cppunit.cfg | | +| dpdk.cfg | | +| embedded_sql.cfg | | +| emscripten.cfg | | +| ginac.cfg | | +| gnu.cfg | | +| googletest.cfg | | +| gtk.cfg | | +| icu.cfg | | +| kde.cfg | | +| libcerror.cfg | | +| libcurl.cfg | | +| libsigc++.cfg | | +| lua.cfg | | +| mfc.cfg | | +| microsoft_atl.cfg | | +| microsoft_sal.cfg | | +| microsoft_unittest.cfg | | +| motif.cfg | | +| nspr.cfg | | +| ntl.cfg | | +| opencv2.cfg | | +| opengl.cfg | | +| openmp.cfg | | +| openssl.cfg | | +| pcre.cfg | | +| posix.cfg | | +| python.cfg | | +| qt.cfg | | +| ruby.cfg | | +| sdl.cfg | | +| sfml.cfg | | +| sqlite3.cfg | | +| std.cfg | | +| tinyxml2.cfg | | +| vcl.cfg | | +| windows.cfg | | +| wxsqlite3.cfg | | +| wxsvg.cfg | | +| wxwidgets.cfg | | +| zephyr.cfg | | +| zlib.cfg | | ## Using your own custom .cfg file From 02a7f2e72bfbbd21d3a0f5ca5bebc217df368882 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:30:35 +0100 Subject: [PATCH 2/4] Update manual.md --- man/manual.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/man/manual.md b/man/manual.md index c4983969a90..181961367c6 100644 --- a/man/manual.md +++ b/man/manual.md @@ -960,12 +960,12 @@ Cppcheck already contains configurations for several libraries. They can be load ## Using a .cfg file -To use a .cfg file shipped with cppcheck, pass the `--library=` option. The table below shows the existing libraries: +To use a .cfg file shipped with cppcheck, pass the `--library=` option. The table below shows the currently existing libraries: | .cfg file | Library | Comment | | ------------- | ------------- | ------------- | -| avr.cfg | | | -| bento4.cfg | | -| boost.cfg | | +| avr.cfg | | +| bento4.cfg | [Bento4](http://www.bento4.com/) | +| boost.cfg | [Boost](http://www.boost.org/)| | bsd.cfg | | | cairo.cfg | | | cppcheck-lib.cfg | | @@ -975,12 +975,12 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | emscripten.cfg | | | ginac.cfg | | | gnu.cfg | | -| googletest.cfg | | -| gtk.cfg | | +| googletest.cfg | [GoogleTest](https://github.com/google/googletest) | +| gtk.cfg | [GTK](https://www.gtk.org/) | | icu.cfg | | | kde.cfg | | | libcerror.cfg | | -| libcurl.cfg | | +| libcurl.cfg | [libcurl](https://curl.se/libcurl/) | | libsigc++.cfg | | | lua.cfg | | | mfc.cfg | | @@ -990,27 +990,27 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | motif.cfg | | | nspr.cfg | | | ntl.cfg | | -| opencv2.cfg | | -| opengl.cfg | | -| openmp.cfg | | -| openssl.cfg | | +| opencv2.cfg | [OpenCV](https://opencv.org/) | +| opengl.cfg | [OpenGL](https://opengl.org/) | +| openmp.cfg | [OpenMP](https://www.openmp.org/) | +| openssl.cfg | [OpenSSL](https://www.openssl.org/) | | pcre.cfg | | | posix.cfg | | | python.cfg | | -| qt.cfg | | +| qt.cfg | [Qt](https://www.qt.io/) | | ruby.cfg | | | sdl.cfg | | | sfml.cfg | | | sqlite3.cfg | | -| std.cfg | | -| tinyxml2.cfg | | +| std.cfg | C/C++ standard library | Loaded by default +| tinyxml2.cfg | [TinyXML-2](https://github.com/leethomason/tinyxml2) | | vcl.cfg | | | windows.cfg | | | wxsqlite3.cfg | | | wxsvg.cfg | | -| wxwidgets.cfg | | +| wxwidgets.cfg | [wxWidgets](https://www.wxwidgets.org/) | | zephyr.cfg | | -| zlib.cfg | | +| zlib.cfg | [zlib](https://www.zlib.net) | ## Using your own custom .cfg file From 6d713f90a4b1ad5cd70bb2d0c216a7357a15af65 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:40:26 +0100 Subject: [PATCH 3/4] Update manual.md --- man/manual.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/man/manual.md b/man/manual.md index 181961367c6..46dfccf727f 100644 --- a/man/manual.md +++ b/man/manual.md @@ -967,9 +967,9 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | bento4.cfg | [Bento4](http://www.bento4.com/) | | boost.cfg | [Boost](http://www.boost.org/)| | bsd.cfg | | -| cairo.cfg | | +| cairo.cfg | [cairo](https://www.cairographics.org/) | | cppcheck-lib.cfg | | -| cppunit.cfg | | +| cppunit.cfg | [CppUnit](https://sourceforge.net/projects/cppunit/) | | dpdk.cfg | | | embedded_sql.cfg | | | emscripten.cfg | | @@ -978,15 +978,15 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | googletest.cfg | [GoogleTest](https://github.com/google/googletest) | | gtk.cfg | [GTK](https://www.gtk.org/) | | icu.cfg | | -| kde.cfg | | -| libcerror.cfg | | +| kde.cfg | [KDE](https://kde.org/) | +| libcerror.cfg | [libcerror](https://github.com/libyal/libcerror) | | libcurl.cfg | [libcurl](https://curl.se/libcurl/) | -| libsigc++.cfg | | +| libsigc++.cfg | [libsigc++](https://github.com/libsigcplusplus/libsigcplusplus) | | lua.cfg | | -| mfc.cfg | | -| microsoft_atl.cfg | | -| microsoft_sal.cfg | | -| microsoft_unittest.cfg | | +| mfc.cfg | [MFC](https://learn.microsoft.com/en-us/cpp/mfc/mfc-desktop-applications) | +| microsoft_atl.cfg | [ATL](https://learn.microsoft.com/en-us/cpp/atl/active-template-library-atl-concepts) | +| microsoft_sal.cfg | [SAL annotations](https://learn.microsoft.com/en-us/cpp/c-runtime-library/sal-annotations) | +| microsoft_unittest.cfg | [CppUnitTest](https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference) | | motif.cfg | | | nspr.cfg | | | ntl.cfg | | @@ -1001,11 +1001,11 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | ruby.cfg | | | sdl.cfg | | | sfml.cfg | | -| sqlite3.cfg | | +| sqlite3.cfg | [SQLite](https://www.sqlite.org/) | | std.cfg | C/C++ standard library | Loaded by default | tinyxml2.cfg | [TinyXML-2](https://github.com/leethomason/tinyxml2) | | vcl.cfg | | -| windows.cfg | | +| windows.cfg | [Win32 API](https://learn.microsoft.com/en-us/windows/win32/) | | wxsqlite3.cfg | | | wxsvg.cfg | | | wxwidgets.cfg | [wxWidgets](https://www.wxwidgets.org/) | From c81ac44b05b28e76aa6a08a20a8b1e6db0b8931c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 28 Nov 2023 08:21:15 +0100 Subject: [PATCH 4/4] Update manual.md --- man/manual.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/man/manual.md b/man/manual.md index 46dfccf727f..bc710d6d947 100644 --- a/man/manual.md +++ b/man/manual.md @@ -956,7 +956,7 @@ This allows you to create and manage multiple configuration files for different When external libraries are used, such as WinAPI, POSIX, gtk, Qt, etc, Cppcheck has no information about functions, types, or macros contained in those libraries. Cppcheck then fails to detect various problems in the code, or might even abort the analysis. But this can be fixed by using the appropriate configuration files. -Cppcheck already contains configurations for several libraries. They can be loaded as described below. Note that the configuration for the standard libraries of C and C++, std.cfg, is always loaded by cppcheck. If you create or update a configuration file for a popular library, we would appreciate if you supply it to the cppcheck project. +Cppcheck already contains configurations for several libraries. They can be loaded as described below. Note that the configuration for the standard libraries of C and C++, std.cfg, is always loaded by cppcheck. If you create or update a configuration file for a popular library, we would appreciate if you supplied it to the cppcheck project. ## Using a .cfg file @@ -966,15 +966,15 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | avr.cfg | | | bento4.cfg | [Bento4](http://www.bento4.com/) | | boost.cfg | [Boost](http://www.boost.org/)| -| bsd.cfg | | +| bsd.cfg | [*BSD](https://www.freebsd.org/) | | cairo.cfg | [cairo](https://www.cairographics.org/) | -| cppcheck-lib.cfg | | +| cppcheck-lib.cfg | [Cppcheck](http://cppcheck.net/) | Used in selfcheck of the Cppcheck code base | cppunit.cfg | [CppUnit](https://sourceforge.net/projects/cppunit/) | | dpdk.cfg | | | embedded_sql.cfg | | | emscripten.cfg | | | ginac.cfg | | -| gnu.cfg | | +| gnu.cfg | [*nix](https://www.gnu.org/) | | googletest.cfg | [GoogleTest](https://github.com/google/googletest) | | gtk.cfg | [GTK](https://www.gtk.org/) | | icu.cfg | | @@ -994,8 +994,8 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | opengl.cfg | [OpenGL](https://opengl.org/) | | openmp.cfg | [OpenMP](https://www.openmp.org/) | | openssl.cfg | [OpenSSL](https://www.openssl.org/) | -| pcre.cfg | | -| posix.cfg | | +| pcre.cfg | [PCRE](https://pcre.org/) | +| posix.cfg | [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/) | | python.cfg | | | qt.cfg | [Qt](https://www.qt.io/) | | ruby.cfg | | @@ -1012,7 +1012,7 @@ To use a .cfg file shipped with cppcheck, pass the `--library=` option. The | zephyr.cfg | | | zlib.cfg | [zlib](https://www.zlib.net) | -## Using your own custom .cfg file +## Creating a custom .cfg file You can create and use your own .cfg files for your projects. Use `--check-library` to get hints about what you should configure.