Catch unrecognised compiler directives in the compiler scanner.

Normally the preprocessor will catch these and report them as undefined
macros. But in case the compiler is run without the preprocessor, also
catch them in the compiler scanner. This will ensure the scanner properly
rejects directives that have additional garbage characters tacked on the
end.
This commit is contained in:
Martin Whitaker 2022-12-20 17:52:26 +00:00
parent cd0b360575
commit 968f0d943e
1 changed files with 5 additions and 0 deletions

View File

@ -894,6 +894,11 @@ TU [munpf]
<< endl;
}
`[a-zA-Z_]+ {
yywarn(yylloc, "macro replacement not supported. "
"Use an external preprocessor.");
}
`{W} { cerr << yylloc.text << ":" << yylloc.first_line << ": error: "
<< "Stray tic (`) here. Perhaps you put white space" << endl;