Skip to content

Commit 251ddae

Browse files
committed
Add tests for C linkage proto generation
1 parent 269fb70 commit 251ddae

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
void setup() {
2+
// put your setup code here, to run once:
3+
}
4+
5+
void loop() {
6+
// put your main code here, to run repeatedly:
7+
test2();
8+
test4();
9+
test6();
10+
test7();
11+
test10();
12+
}
13+
14+
extern "C" {
15+
void test2() {}
16+
}
17+
18+
extern "C"
19+
{
20+
void test4() {}
21+
}
22+
23+
extern "C"
24+
25+
{
26+
void test6() {}
27+
}
28+
29+
// this function should not have C linkage
30+
void test7() {}
31+
32+
extern "C" void test10() {
33+
34+
};

src/arduino.cc/builder/test/try_build_of_problematic_sketch_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ func TestTryBuild039(t *testing.T) {
205205
tryBuildWithContext(t, ctx, "sketch12", "sketch12.ino")
206206
}
207207

208+
func TestTryBuild040(t *testing.T) {
209+
tryBuild(t, "sketch_with_externC_multiline", "sketch_with_externC_multiline.ino")
210+
}
211+
208212
func makeDefaultContext(t *testing.T) *types.Context {
209213
DownloadCoresAndToolsAndLibraries(t)
210214

0 commit comments

Comments
 (0)