Skip to content

Commit e3af2f5

Browse files
committed
add fix
1 parent c213c54 commit e3af2f5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎simplecpp.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
10691069

10701070
if (cback() && cback()->location.line == location.line && cback()->previous && cback()->previous->op == '#') {
10711071
const Token* const ppTok = cback()->previous;
1072-
if (ppTok->next && (ppTok->next->str() == "error" || ppTok->next->str() == "warning")) {
1072+
// #error/#warning directive => '#' is the first token on the line (not the stringizing operator in a #define)
1073+
if (ppTok->next && (ppTok->next->str() == "error" || ppTok->next->str() == "warning") && isLastLinePreprocessor(2) == ppTok) {
10731074
readErrorText(stream, ch, location);
10741075
continue;
10751076
}

0 commit comments

Comments
 (0)