code-base-investigator icon indicating copy to clipboard operation
code-base-investigator copied to clipboard

Introduce meta-warnings

Open Pennycook opened this issue 1 year ago • 0 comments

Related issues

Closes #108.

Proposed changes

  • Introduce a MetaWarning class that describes a meta-warning message and the condition(s) in which it should be generated. This is currently a regular expression, since our warning messages are not standardized. If we introduce flags like -Wmissing-user-include and -Wmissing-system-include, we could search for those strings in warnings instead.
  • Introduce a WarningAggregator class that acts as a logging.Filter; it reads every record written to the log, and checks if it satisfies the condition(s) for any MetaWarning(s).
  • Generate the meta-warnings after preprocessing has completed.

Here's an example of the current output from a real run, to help you make sense of the horrible string formatting:

[WARNING ] 4443 warnings generated during preprocessing.
[WARNING ] 131 user include files could not be found.
  These could contain important macros and includes.
  Suggested solutions:
  - Check that the file(s) exist in the code base.
  - Check the include paths in the compilation database.
  - Check if the include(s) should have used '<>'.
[WARNING ] 4312 system include files could not be found.
  These could define important feature macros.
  Suggested solutions:
  - Check that the file(s) exist on your system.
  - Use .cbi/config to define system include paths.
  - Use .cbi/config to define important macros.

Pennycook avatar Sep 25 '24 15:09 Pennycook