Improve no_eof_newline warning by glankk · Pull Request #692 · cppcheck-opensource/simplecpp · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions main.cpp
4 changes: 2 additions & 2 deletions simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,11 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
location.adjust(currentToken);
}

if (!trailing_nl && outputList) {
if ((cstd != CUnknown || cppstd == CPPUnknown) && !trailing_nl && outputList) {
Output err{
Output::PORTABILITY_NO_EOF_NEWLINE,
location,
"No newline at end of file."
"No newline at end of file is undefined behavior in C."
};
outputList->emplace_back(std::move(err));
}
Expand Down
18 changes: 13 additions & 5 deletions test.cpp
Loading