Skip to content

verify: Stop a file whose command line has an error, and verify a .h input as C++ - #19

Merged
SwayamInSync merged 3 commits into
mainfrom
fix/input-errors
Oct 14, 2026
Merged

SwayamInSync merged 3 commits into
mainfrom
fix/input-errors

Conversation

@SwayamInSync

Copy link
Copy Markdown
Owner

A compiler error in a command line was printed and then ignored: the file was verified anyway, under different options than the ones given, and cpp-verify exited 0.

Input Main This change
header.h error: invalid argument '-std=c++17' not allowed with 'C', then Verified, exit 0 Verified, exit 0
file.c the same error, then Verified, exit 0 the error, not verified, exit 1
file.cpp -- -fbogus-flag error: unknown argument, then Verified, exit 0 the error, not verified, exit 1
file.cpp -- -std=c++99 error: invalid value 'c++99', then Verified, exit 0 the error, not verified, exit 1

Clang's tooling reports driver and argument errors and goes on (ToolInvocation::run never checks them), where clang stops. cpp-verify now gives the tool a diagnostics consumer for those errors, and its action factory stops a file whose command line produced one; the frontend still reports with the file's own diagnostic options. A .h file is compiled as a C++ header, since clang takes it for C.

Testing: suite/input_errors.cpp fails on main; removing the header adjustment fails its header case, and letting a file with an argument error run fails the flag case. Verify suite: 398 passed, 1 unsupported.

@SwayamInSync
SwayamInSync merged commit 89c71c9 into main Oct 14, 2026
13 checks passed
@SwayamInSync
SwayamInSync deleted the fix/input-errors branch October 14, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant