Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
This repository was 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

@warmsocks

Description

@warmsocks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions