From 8c74615c840bd433ca2f52441fbe0d7b33d1327d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Feb 2026 11:56:59 +0100 Subject: [PATCH 1/7] Fix #14475 (Document unknownMacro) --- man/checkers/unknownMacro.md | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 man/checkers/unknownMacro.md diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md new file mode 100644 index 00000000000..79434b1b9b6 --- /dev/null +++ b/man/checkers/unknownMacro.md @@ -0,0 +1,61 @@ + +# unknownMacro + +**Message**: There is an unknown macro here somewhere. Configuration is required. If AAA is a macro then please configure it. [unknownMacro] +
+**Category**: Configuration
+**Severity**: Error
+**Language**: C and C++ + +## Description + +Cppcheck has found code that is confusing and does not know how to analyze it. Analysis is aborted. + +Your code is probably OK but you need to configure Cppcheck to understand the code better. + +## How to fix + +Review the configuration. + +If Cppcheck warns about a macro that is defined in a header, make sure that this header is included properly Cppcheck must have the include path. + +If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if cppcheck should just ignore the keyword then +an `-DKEYWORD=` option is suggested. + +## Example + +### Example code 1 +``` + fprintf(stderr, "Generating up to " F_U64 " sequences and up to " F_U64 " bases.\n", nSeqs, nBases); +``` + +Warning: + +canu-2.2/src/seqrequester/src/seqrequester/generate.H:72:41: error: There is an unknown macro here somewhere. Configuration is required. If F_U64 is a macro then please configure it. [unknownMacro] + +Fix: + +Somehow `F_U64` must be specified for Cppcheck to be able to analyse this properly. Either: + * Add `-DF_U64="x"` to explicitly tell Cppcheck what it should replace F_U64 with. Or; + * Add `-I..` so that headers are included properly. + + +### Example code 2 +``` +BOTAN_FUNC_ISA("crypto") +void AES_128::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const +``` + +Warning: + +ftp://ftp.de.debian.org/debian/pool/main/b/botan/botan_2.19.5+dfsg.orig.tar.xz +botan-2.19.5+dfsg/src/lib/block/aes/aes_power8/aes_power8.cpp:103:1: error: There is an unknown macro here somewhere. Configuration is required. If BOTAN_FUNC_ISA is a macro then please configure it. [unknownMacro] + +Fix: + +Somehow `BOTAN_FUNC_ISA` must be specified for Cppcheck to be able to analyse this properly. Either: + * Add `-DBOTAN_FUNC_ISA(X)=` to explicitly tell Cppcheck that BOTAN_FUNC_ISA("crypto") should be ignored. Or; + * Add `-I..` so that headers are included properly. + + + From 924f02141d472dcb8644b33f1e2d03b14d27dc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Feb 2026 13:12:48 +0100 Subject: [PATCH 2/7] Apply suggestion from @chrchr-github Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com> --- man/checkers/unknownMacro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index 79434b1b9b6..a4abbafdc6e 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -17,7 +17,7 @@ Your code is probably OK but you need to configure Cppcheck to understand the co Review the configuration. -If Cppcheck warns about a macro that is defined in a header, make sure that this header is included properly Cppcheck must have the include path. +If Cppcheck warns about a macro that is defined in a header, make sure that this header is included properly. Cppcheck must have the include path. If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if cppcheck should just ignore the keyword then an `-DKEYWORD=` option is suggested. From 16e0b82722861d57a1b28ea2acec64a2da3db63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Feb 2026 13:13:56 +0100 Subject: [PATCH 3/7] review --- man/checkers/unknownMacro.md | 1 - 1 file changed, 1 deletion(-) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index a4abbafdc6e..22058e43a77 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -48,7 +48,6 @@ void AES_128::hw_aes_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) Warning: -ftp://ftp.de.debian.org/debian/pool/main/b/botan/botan_2.19.5+dfsg.orig.tar.xz botan-2.19.5+dfsg/src/lib/block/aes/aes_power8/aes_power8.cpp:103:1: error: There is an unknown macro here somewhere. Configuration is required. If BOTAN_FUNC_ISA is a macro then please configure it. [unknownMacro] Fix: From 184adef26be3d01fb7ee9c927c5bf2b7b76d9d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Feb 2026 13:21:49 +0100 Subject: [PATCH 4/7] add --library suggestions --- man/checkers/unknownMacro.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index 22058e43a77..fd70c037423 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -17,7 +17,9 @@ Your code is probably OK but you need to configure Cppcheck to understand the co Review the configuration. -If Cppcheck warns about a macro that is defined in a header, make sure that this header is included properly. Cppcheck must have the include path. +If Cppcheck warns about a macro that is defined in a 3rd party library, and there is a cfg file for that, then a `--library=` option may be a proper solution. + +If Cppcheck warns about a macro that is defined in a header that should included, make sure that this header is included properly. Cppcheck must have the include path. If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if cppcheck should just ignore the keyword then an `-DKEYWORD=` option is suggested. @@ -38,7 +40,7 @@ Fix: Somehow `F_U64` must be specified for Cppcheck to be able to analyse this properly. Either: * Add `-DF_U64="x"` to explicitly tell Cppcheck what it should replace F_U64 with. Or; * Add `-I..` so that headers are included properly. - + * If the symbol is defined in a 3rd party library adding a corresponding `--library=` might solve such issue. ### Example code 2 ``` @@ -55,6 +57,7 @@ Fix: Somehow `BOTAN_FUNC_ISA` must be specified for Cppcheck to be able to analyse this properly. Either: * Add `-DBOTAN_FUNC_ISA(X)=` to explicitly tell Cppcheck that BOTAN_FUNC_ISA("crypto") should be ignored. Or; * Add `-I..` so that headers are included properly. + * If the symbol is defined in a 3rd party library adding a corresponding `--library=` might solve such issue. From bbdd8bcd0d7717292eada1af79ce9ab968681b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 10 Feb 2026 19:41:31 +0100 Subject: [PATCH 5/7] critical error --- man/checkers/unknownMacro.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index fd70c037423..42278e7ee01 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -13,6 +13,8 @@ Cppcheck has found code that is confusing and does not know how to analyze it. A Your code is probably OK but you need to configure Cppcheck to understand the code better. +This is a critical error, the analysis of the whole translation unit is aborted. Such error in a header file can mean that analysis of many source files are aborted. + ## How to fix Review the configuration. From 7d5ca694ec9a82fc45a27654a690c2d8e21deeb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 11 Feb 2026 08:53:20 +0100 Subject: [PATCH 6/7] Update man/checkers/unknownMacro.md [skip ci] Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com> --- man/checkers/unknownMacro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index 42278e7ee01..8f8bf90c372 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -21,7 +21,7 @@ Review the configuration. If Cppcheck warns about a macro that is defined in a 3rd party library, and there is a cfg file for that, then a `--library=` option may be a proper solution. -If Cppcheck warns about a macro that is defined in a header that should included, make sure that this header is included properly. Cppcheck must have the include path. +If Cppcheck warns about a macro that is defined in a header that should be included, make sure that this header is included properly. Cppcheck must have the include path. If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if cppcheck should just ignore the keyword then an `-DKEYWORD=` option is suggested. From 97fefe33fa0eb982c26c326bde6d40a761882444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 11 Feb 2026 11:58:44 +0100 Subject: [PATCH 7/7] tweak --- man/checkers/unknownMacro.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/man/checkers/unknownMacro.md b/man/checkers/unknownMacro.md index 8f8bf90c372..52599215d89 100644 --- a/man/checkers/unknownMacro.md +++ b/man/checkers/unknownMacro.md @@ -9,22 +9,25 @@ ## Description -Cppcheck has found code that is confusing and does not know how to analyze it. Analysis is aborted. +Cppcheck has found code that is confusing and does not know how to analyze it. This is a critical +error, the analysis of the whole translation unit is aborted. Such error in a header file can mean +that analysis of many source files are aborted. -Your code is probably OK but you need to configure Cppcheck to understand the code better. - -This is a critical error, the analysis of the whole translation unit is aborted. Such error in a header file can mean that analysis of many source files are aborted. +Your code is probably OK but you need to configure Cppcheck to make Cppcheck understand the code +better. ## How to fix Review the configuration. -If Cppcheck warns about a macro that is defined in a 3rd party library, and there is a cfg file for that, then a `--library=` option may be a proper solution. +If Cppcheck warns about a macro that is defined in a 3rd party library, and there is a cfg file for +that, then a `--library=` option may be a proper solution. -If Cppcheck warns about a macro that is defined in a header that should be included, make sure that this header is included properly. Cppcheck must have the include path. +If Cppcheck warns about a macro that is defined in a header that should be included, make sure that +this header is included properly. Cppcheck must have the include path. -If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if cppcheck should just ignore the keyword then -an `-DKEYWORD=` option is suggested. +If Cppcheck warns about a compiler keyword add a `-D` that defines this keyword somehow. I.e. if +cppcheck should just ignore the keyword then an `-DKEYWORD=` option is suggested. ## Example