FlintPlusPlus
FlintPlusPlus copied to clipboard
Whitespace between # and "error" or "line" causes bogus errors to be reported
If a #error or #line preprocessor directive contains whitespace between the # and the word "error" or "line", the tokenizer breaks and bogus errors are reported.
Example 1: "# errror ..."
#ifndef ERROR_HPP
#define ERROR_HPP
#if abcdefg
# error Gadzooks.
#endif
#endif // ERROR_HPP
Results in this:
$ flint++ Error.hpp
[Error ] Error.hpp:5: Unmatched #if/#endif.
[Error ] Error.hpp:5: Include guard doesn't cover the entire file.
Lint Summary: 1 files
Errors: 2 Warnings: 0 Advice: 0
Estimated Lines of Code: 5
Example 2: "# line ..."
#ifndef LINE_HPP
#define LINE_HPP
#if abcdefg
# line 12345678
#endif
#endif // LINE_HPP
Results in this:
$ flint++ Error.hpp
[Error ] Line.hpp:5: Unmatched #if/#endif.
[Error ] Line.hpp:5: Include guard doesn't cover the entire file.
Lint Summary: 1 files
Errors: 2 Warnings: 0 Advice: 0
Estimated Lines of Code: 5