fix: relax -Werror for user sketches + un-nest /* */ in robot-desktop-eyes

Two related fixes for the ESP32 Arduino-compat compile path:

(a) backend/app/services/esp-idf-template/main/CMakeLists.txt:
    Demote -Werror=comment / =parentheses / =sign-compare / =narrowing
    / =write-strings / =missing-field-initializers / =reorder back to
    plain warnings. ESP-IDF's project defaults are stricter than what
    Arduino/arduino-cli users expect, so common Arduino idioms (nested
    /* */, missing field initializers in struct literals, etc.) were
    failing builds that compile fine in the Arduino IDE. -Wall stays
    on; we just stop the abort.

(b) examples-robot-desktop.ts (robot-desktop-eyes example):
    Replace the nested /* xTaskCreatePinnedToCore( ... /* Task function. */
    ... */ block with `#if 0 / #endif` so the inner block comments
    don't terminate the outer one. Even with -Wno-error=comment the
    real-syntax-level issue (the first inner `*/` closes the outer
    comment, leaving the rest of the lines as bare code) would still
    bite, so this needs an actual code fix.
This commit is contained in:
David Montero 2026-05-23 16:19:48 +02:00
parent a86a0a45bd
commit 0d43c5f892
2 changed files with 18 additions and 1 deletions

View File

@ -67,6 +67,23 @@ if(DEFINED ENV{ARDUINO_ESP32_PATH})
target_compile_definitions(${COMPONENT_LIB} PRIVATE
"LED_BUILTIN=2")
endif()
# Relax `-Werror=` for user sketches. ESP-IDF defaults treat several
# warning categories as errors (-Werror=comment, -Werror=missing-field-
# initializers, etc.) which is great for IDF itself but ruthless for
# user Arduino code that often has nested /* */ comments,
# parenthesized macros, or other idioms that compile fine under
# arduino-cli's permissive defaults. Demoting these to plain warnings
# gives users the same "it just compiles" experience they expect from
# the Arduino IDE without disabling -Wall entirely.
target_compile_options(${COMPONENT_LIB} PRIVATE
-Wno-error=comment
-Wno-error=parentheses
-Wno-error=sign-compare
-Wno-error=narrowing
-Wno-error=write-strings
-Wno-error=missing-field-initializers
-Wno-error=reorder)
else()
# Pure ESP-IDF mode: main.c #includes sketch_translated.c
idf_component_register(

File diff suppressed because one or more lines are too long