Open
Description
Describe the problem
When compiling a broken sketch, the CLI might dump the error location multiple times to the std err. It is most likely related to how the sketch files are preprocessed and the prototype is created. (Of course, I am just guessing here 😊)
To reproduce
sketch_jun14c.ino
:
void setup(){}
void loop() {
byte = 2;
}
Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino: In function 'void loop()':
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:3:8: error: expected unqualified-id before '=' token
byte = 2;
^
sketch_jun14c.ino
:
void setup(){}
void 1loop() {
byte = 2;
}
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:6: error: expected unqualified-id before numeric constant
void 1loop() {
^~~~~
sketch_jun14c.ino
:
void setup(){}
xvoid loop() {
byte = 2;
}
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:1: error: 'xvoid' does not name a type; did you mean 'void'?
xvoid loop() {
^~~~~
void
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:1: error: 'xvoid' does not name a type; did you mean 'void'?
xvoid loop() {
^~~~~
void
Click to see full console output
a.kitta@Akoss-MacBook-Pro build % ~/Downloads/arduino-cli version
arduino-cli Version: nightly-20220614 Commit: 76fab32 Date: 2022-06-14T08:23:46Z
a.kitta@Akoss-MacBook-Pro build % cat ~/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino
void setup(){}
void loop() {
byte = 2;
}% a.kitta@Akoss-MacBook-Pro build % ~/Downloads/arduino-cli compile -b arduino:mbed_nano:nanorp2040connect ~/Documents/Arduino/sketch_jun14c
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino: In function 'void loop()':
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:3:8: error: expected unqualified-id before '=' token
byte = 2;
^
Used platform Version Path
arduino:mbed_nano 3.1.1 /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/3.1.1
Error during build: exit status 1
a.kitta@Akoss-MacBook-Pro build % cat ~/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino
void setup(){}
void 1loop() {
byte = 2;
}% a.kitta@Akoss-MacBook-Pro build % ~/Downloads/arduino-cli compile -b arduino:mbed_nano:nanorp2040connect ~/Documents/Arduino/sketch_jun14c
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:6: error: expected unqualified-id before numeric constant
void 1loop() {
^~~~~
Used platform Version Path
arduino:mbed_nano 3.1.1 /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/3.1.1
Error during build: exit status 1
a.kitta@Akoss-MacBook-Pro build % cat ~/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino
void setup(){}
xvoid loop() {
byte = 2;
}% a.kitta@Akoss-MacBook-Pro build % ~/Downloads/arduino-cli compile -b arduino:mbed_nano:nanorp2040connect ~/Documents/Arduino/sketch_jun14c
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:1: error: 'xvoid' does not name a type; did you mean 'void'?
xvoid loop() {
^~~~~
void
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:1: error: 'xvoid' does not name a type; did you mean 'void'?
xvoid loop() {
^~~~~
void
Used platform Version Path
arduino:mbed_nano 3.1.1 /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/mbed_nano/3.1.1
Error during build: exit status 1
Expected behavior
I would expect to see the following error once:
/Users/a.kitta/Documents/Arduino/sketch_jun14c/sketch_jun14c.ino:2:1: error: 'xvoid' does not name a type; did you mean 'void'?
xvoid loop() {
^~~~~
void
Arduino CLI version
arduino-cli Version: nightly-20220614 Commit: 76fab32 Date: 2022-06-14T08:23:46Z
Operating system
macOS
Operating system version
12.3.1
Additional context
No response
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the nightly build
- My report contains all necessary details