Skip to content

Fix extern "C" prototype generation #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/arduino.cc/builder/ctags/ctags_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down