#line
directive inserted incorrectly when sketch under path w/ "
and contains #include <Arduino.h>
#1946
Labels
topic: build-process
Related to the sketch build process
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
In order to make it easier for beginners to get started with writing Arduino sketches, and for the convenience of all users, Arduino CLI does some minor preprocessing of the
.ino
files of a sketch to convert them to C++.This preprocessing includes adding lines to the code and changing the file name. In order to cause the warning and error messages from the compiler to match the file names and line numbers of the user's sketch code,
#line
directives are inserted by the preprocessor.🐛 A
#line
directive is inserted incorrectly under the following conditions:"
)#include
directive forArduino.h
To reproduce
🐛 The corrupted
#line
directive caused the sketch compilation to fail with cryptic errors. It will be very difficult for the average user to understand why the compilation failed and how to fix the error.🐛 Even the
#line
directive that is syntactically valid has an incorrect path due to it being truncated at the"
character.Expected behavior
#line
directives are inserted correctly regardless of which characters are present in the path and which#include
directives are present in the sketch.Arduino CLI version
f239754
Operating system
Ubuntu, macOS
Operating system version
Additional context
The bug is not applicable to Windows because
"
is not an allowed character for Windows paths.The
#include
directive for theArduino.h
file specifically is a required condition. The bug does not occur for sketches that only contain#include
directives for other files.Note this is not about supporting double quotes in sketch filenames. This is about their presence in the parent path of the sketch.
Related: #1945
Originally reported at https://forum.arduino.cc/t/mac-montery-and-library-update/1041060/21
Issue checklist
The text was updated successfully, but these errors were encountered: