mirror of
https://github.com/esphome/esphome.git
synced 2024-12-25 23:14:54 +01:00
My Home-IoT
c7c71089ce
* Use #line directives in generated C++ code for lambdas The #line directive in gcc is meant specifically for pieces of imported code included in generated code, exactly what happens with lambdas in the yaml files: https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html With this change, if I add the following at line 165 of kithen.yaml: - lambda: undefined_var == 5; then "$ esphome kitchen.yaml compile" shows the following: INFO Reading configuration kitchen.yaml... INFO Generating C++ source... INFO Compiling app... INFO Running: platformio run -d kitchen <...> Compiling .pioenvs/kitchen/src/main.cpp.o kitchen.yaml: In lambda function: kitchen.yaml:165:7: error: 'undefined_var' was not declared in this scope *** [.pioenvs/kitchen/src/main.cpp.o] Error 1 == [FAILED] Took 2.37 seconds == * Silence gcc warning on multiline macros in lambdas When the \ is used at the end of the C++ source in a lambda (line continuation, often used in preprocessor macros), esphome will copy that into main.cpp once as code and once as a // commment. gcc will complain about the multiline commment: Compiling .pioenvs/kitchen/src/main.cpp.o kitchen.yaml:640:3: warning: multi-line comment [-Wcomment] Try to replace the \ with a "<cont>" for lack of a better idea. |
||
---|---|---|
.devcontainer | ||
.github | ||
.vscode | ||
docker | ||
esphome | ||
script | ||
tests | ||
.clang-format | ||
.clang-tidy | ||
.coveragerc | ||
.dockerignore | ||
.editorconfig | ||
.gitignore | ||
.gitpod.yml | ||
.pre-commit-config.yaml | ||
CODE_OF_CONDUCT.md | ||
CODEOWNERS | ||
CONTRIBUTING.md | ||
LICENSE | ||
MANIFEST.in | ||
platformio.ini | ||
pylintrc | ||
pytest.ini | ||
README.md | ||
requirements.txt | ||
requirements_test.txt | ||
setup.cfg | ||
setup.py |
ESPHome
Documentation: https://esphome.io/
For issues, please go to the issue tracker.
For feature requests, please see feature requests.