You can discard a warning in a line of code using the conf parameter WARNING_FILTER
, as you tried before, like this:
The syntax is: WARNING_FILTER += <action> <rule> [<rule> ...]
Discard all warnings occurring in file main.c on line 11.
(Note: If there are two or more s in a pattern, the pattern will be applied to warnings that match ALL of the rules.)
WARNING_FILTER += discard file=main.c line=11
Discard all warnings occurring on a source line that contains the text "do not issue a warning here" (presumably in a comment).
WARNING_FILTER += discard line_contents:"do not issue a warning here"
The parameter you tried before will only work if the line of code in your project contains "NOLINT".
You can read more about how the WARNING_FILTER
parameter is used in the CodeSonar manual, accessible from your CodeSonar hub by click on the link "Manual" in the top right menu on all pages of the hub, by searching for "warning_filter". The first result should be "Compiler-Independent Configuration File Parameters", search this page for "Allows warnings to be modified before they are submitted to the hub, or discarded entirely without being submitted.".
If you want to deal with the warnings on a case by case basis you can set the warning finding to "Don't Care". Once set, the warning will not show up unless you use the visible warnings filter "All" in your hub. (more info in the manual by searching for "Visibility Filter selector", and clicking the search result "GUI Reference", then searching in that page for "Visibility Filter selector")
The setting will persist for all future analyses.
You can find more information on changing warnings in the manual by search for "warning report", clicking the search result "GUI: Warning Report", and searching the page for "Change Warning Form".
If you do not want to see warnings for system include files you can use this parameter:
WARNING_FILTER += discard is_sysinclude
(Note: you will need to make sure to set the parameter: SYSTEM_INCLUDE_PATHS
, more info in the manual by searching for "system_include_paths", and clicking the search result "Compiler Independent Configuration File Parameters", then searching the page for "Specifies file system paths which contain system include headers.")
The email to contact GrammaTech support directly is located in the manual under contents: "CodeSonar Manual".