Skip to content

Commit f51f632

Browse files
committed
Use "not" instead of "set +o pipefail"; improve "broken" header.
A header shouldn't contain a function body unless the function is inline. Following gribozavr's suggestion, I'm using the easier solution of omitting the semicolon from the function prototype. (In response to review comments.)
1 parent 45503ab commit f51f632

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
// This C code intentionally doesn't compile (note missing parenthesis).
2-
void foo(int bar {
3-
}
1+
// This C code intentionally doesn't compile (note missing semicolon).
2+
void foo()

test/Frontend/verify-broken-c-module.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
// This needs to be a separate test from verify.swift because compilation will
44
// terminate after the failing import statement.
55

6-
// Turn off "pipefail" mode because we intend the `swift` invocation to
7-
// terminate with a non-zero exit code, and we don't want the test to fail
8-
// because of this.
9-
// RUN: set +o pipefail && %target-typecheck-verify-swift -I %S/Inputs/broken-c-module 2>&1 | %FileCheck %s
6+
// RUN: not %target-typecheck-verify-swift -I %S/Inputs/broken-c-module 2>&1 | %FileCheck %s
107

118
// CHECK: [[@LINE+3]]:8: error: unexpected error produced: could not build C module
129
// CHECK: note: in file included from <module-includes>
13-
// CHECK: broken_c.h:2:18: error: expected ')'
10+
// CHECK: broken_c.h:2:11: error: expected function body after function declarator
1411
import BrokenCModule

test/Frontend/verify.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Tests for the Swift frontends `-verify` mode.
22

3-
// Turn off "pipefail" mode because we intend the `swift` invocation to
4-
// terminate with a non-zero exit code, and we don't want the test to fail
5-
// because of this.
6-
// RUN: set +o pipefail && %target-typecheck-verify-swift 2>&1 | %FileCheck %s
3+
// RUN: not %target-typecheck-verify-swift 2>&1 | %FileCheck %s
74

85
// CHECK: [[@LINE+1]]:1: error: unexpected error produced: use of unresolved
96
undefinedFunc()

0 commit comments

Comments
 (0)