Skip to content

Commit 032a930

Browse files
Make 3c -verify an error for now. (#519)
PR #488 made `3c -verify` cover only the compiler diagnostics, but none of our regression tests actually use that functionality. Instead, one regression test (macro_function_call) used `3c -verify` to try to test the absence of 3C warnings, and we were unaware that the test wasn't testing what it was supposed to. I think it's best to make `3c -verify` an error for now so we don't make that mistake again.
1 parent 0a06522 commit 032a930

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

clang/lib/3C/3C.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ _3CInterface::_3CInterface(const struct _3COptions &CCopt,
186186

187187
ConstraintsBuilt = false;
188188

189+
if (VerifyDiagnosticOutput) {
190+
errs() << "3C initialization error: Diagnostic verification is currently "
191+
"unsupported.\n";
192+
Failed = true;
193+
return;
194+
}
195+
189196
if (OutputPostfix != "-" && !OutputDir.empty()) {
190197
errs() << "3C initialization error: Cannot use both -output-postfix and "
191198
"-output-dir\n";
@@ -287,6 +294,9 @@ bool _3CInterface::parseASTs() {
287294

288295
auto *Tool = new ClangTool(*CurrCompDB, SourceFiles);
289296
Tool->appendArgumentsAdjuster(getIgnoreCheckedPointerAdjuster());
297+
// NOTE: This code is currently unreachable because VerifyDiagnosticOutput is
298+
// rejected in the _3CInterface constructor.
299+
//
290300
// TODO: This currently only enables compiler diagnostic verification.
291301
// see https://github.com/correctcomputation/checkedc-clang/issues/425
292302
// for status.

clang/test/3C/macro_function_call.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// RUN: rm -rf %t*
2-
// RUN: 3c -base-dir=%S -verify -alltypes -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_ALL","CHECK" %s
3-
// RUN: 3c -base-dir=%S -verify -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
4-
// RUN: 3c -base-dir=%S -verify -alltypes -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
5-
// RUN: 3c -base-dir=%S -verify -alltypes -output-dir=%t.checked %s --
6-
// RUN: 3c -base-dir=%t.checked -verify -alltypes %t.checked/macro_function_call.c -- | diff %t.checked/macro_function_call.c -
2+
// RUN: 3c -base-dir=%S -alltypes -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_ALL","CHECK" %s
3+
// RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
4+
// RUN: 3c -base-dir=%S -alltypes -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
5+
// RUN: 3c -base-dir=%S -alltypes -output-dir=%t.checked %s --
6+
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/macro_function_call.c -- | diff %t.checked/macro_function_call.c -
77

88
// Test fix for https://github.com/correctcomputation/checkedc-clang/issues/439
99
// We cannot insert casts on function calls inside macros, so constraints must
@@ -12,6 +12,13 @@
1212

1313
// 3C emits a warning if it fails inserting a cast. Ensure the test fails if
1414
// this happens.
15+
//
16+
// NOTICE: This part of the test is disabled (the -verify option has been
17+
// removed from the 3c RUN commands) until we have a replacement for the
18+
// diagnostic verifier
19+
// (https://github.com/correctcomputation/checkedc-clang/issues/503).
20+
// TODO: Re-enable it when we do.
21+
//
1522
// expected-no-diagnostics
1623

1724
// Unsafe call in macro. This would require an _Assume_bounds_cast, but we

0 commit comments

Comments
 (0)