Skip to content

Commit 3b6ed82

Browse files
committed
Suppress PORTABILITY_NO_EOF_NEWLINE when standard is c++ or unknown
1 parent 94f5500 commit 3b6ed82

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ int main(int argc, char **argv)
276276
std::cerr << "portability: ";
277277
break;
278278
case simplecpp::Output::PORTABILITY_NO_EOF_NEWLINE:
279+
if (simplecpp::getCStd(dui.std) == simplecpp::CUnknown) {
280+
// Only UB for c code, suppress for c++ code
281+
// If no standard is specified then prefer to have a false negative
282+
continue;
283+
}
279284
std::cerr << "portability: ";
280285
break;
281286
case simplecpp::Output::UNHANDLED_CHAR_ERROR:

0 commit comments

Comments
 (0)