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

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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