Skip to content

Regression when using default parameters #23

Closed
@matthijskooijman

Description

@matthijskooijman

Consider this sketch:

void test(int x = 1) {
}

void setup() {
}

void loop() {
}

When using 1.6.5 this compiles, but it breaks when using arduino-builder. I remember reading that supporting optional arguments with arduino-builder/ctags is too tricky, so it was intentionally left out. However, since the old regex-based parser code simply did not recognize functions using default arguments at all (so did not generate a prototype for them), this means that functions using default arguments compiled properly before, but not anymore.

Perhaps it is possible to detect that default arguments are present in a function prototype and if so, refrain from generating a prototype? Ideally, a prototype is generated with the default arguments removed, but that is probably tricky to get right (without involving things like libclang).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions