-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix #14475 (Document unknownMacro) #8194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8c74615
Fix #14475 (Document unknownMacro)
danmar 924f021
Apply suggestion from @chrchr-github
danmar 16e0b82
review
danmar 184adef
add --library suggestions
danmar bbdd8bc
critical error
danmar 7d5ca69
Update man/checkers/unknownMacro.md [skip ci]
danmar 97fefe3
tweak
danmar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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] | ||
| <br/> | ||
| **Category**: Configuration<br/> | ||
| **Severity**: Error<br/> | ||
| **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 | ||
|
danmar marked this conversation as resolved.
Outdated
|
||
| 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. | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.