diff --git a/src/arduino.cc/builder/ctags/ctags_parser.go b/src/arduino.cc/builder/ctags/ctags_parser.go index 0a73391f..b756c3f5 100644 --- a/src/arduino.cc/builder/ctags/ctags_parser.go +++ b/src/arduino.cc/builder/ctags/ctags_parser.go @@ -47,6 +47,7 @@ const KIND_FUNCTION = "function" const TEMPLATE = "template" const STATIC = "static" +const EXTERN = "extern \"C\"" var KNOWN_TAG_KINDS = map[string]bool{ "prototype": true, @@ -101,6 +102,9 @@ func addPrototype(tag *types.CTag) { if strings.Index(tag.Code, STATIC+" ") != -1 { tag.PrototypeModifiers = tag.PrototypeModifiers + " " + STATIC } + if strings.Index(tag.Code, EXTERN+" ") != -1 { + tag.PrototypeModifiers = tag.PrototypeModifiers + " " + EXTERN + } tag.PrototypeModifiers = strings.TrimSpace(tag.PrototypeModifiers) } diff --git a/src/arduino.cc/builder/test/sketch_with_externC/sketch_with_externC.ino b/src/arduino.cc/builder/test/sketch_with_externC/sketch_with_externC.ino new file mode 100644 index 00000000..8e6c53ea --- /dev/null +++ b/src/arduino.cc/builder/test/sketch_with_externC/sketch_with_externC.ino @@ -0,0 +1,11 @@ +void setup() { + // put your setup code here, to run once: + test(); +} + +void loop() { + // put your main code here, to run repeatedly: + +} + +extern "C" void test() {} \ No newline at end of file diff --git a/src/arduino.cc/builder/test/try_build_of_problematic_sketch_test.go b/src/arduino.cc/builder/test/try_build_of_problematic_sketch_test.go index 08eccaf1..bac46ac5 100644 --- a/src/arduino.cc/builder/test/try_build_of_problematic_sketch_test.go +++ b/src/arduino.cc/builder/test/try_build_of_problematic_sketch_test.go @@ -191,6 +191,10 @@ func TestTryBuild036(t *testing.T) { tryBuildWithContext(t, context, "sketch11", "sketch_fastleds.ino") } +func TestTryBuild037(t *testing.T) { + tryBuild(t, "sketch_with_externC", "sketch_with_externC.ino") +} + func makeDefaultContext(t *testing.T) map[string]interface{} { DownloadCoresAndToolsAndLibraries(t)