Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Whitespace between # and "error" or "line" causes bogus errors to be reported #60

Open
warmsocks opened this issue Mar 6, 2019 · 0 comments

Comments

@warmsocks
Copy link

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
warmsocks pushed a commit to warmsocks/FlintPlusPlus that referenced this issue Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant