1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-17 10:42:21 +01:00

Suppress spurious volatile and Python syntax warnings during builds (#9488)

This commit is contained in:
J. Nick Koston
2025-07-13 21:47:52 -10:00
committed by GitHub
parent 873f4125c5
commit e7d819a656
2 changed files with 21 additions and 0 deletions

View File

@@ -162,6 +162,9 @@ def get_ini_content():
# Sort to avoid changing build unflags order
CORE.add_platformio_option("build_unflags", sorted(CORE.build_unflags))
# Add extra script for C++ flags
CORE.add_platformio_option("extra_scripts", ["pre:cxx_flags.py"])
content = "[platformio]\n"
content += f"description = ESPHome {__version__}\n"
@@ -222,6 +225,9 @@ def write_platformio_project():
write_gitignore()
write_platformio_ini(content)
# Write extra script for C++ specific flags
write_cxx_flags_script()
DEFINES_H_FORMAT = ESPHOME_H_FORMAT = """\
#pragma once
@@ -394,3 +400,16 @@ def write_gitignore():
if not os.path.isfile(path):
with open(file=path, mode="w", encoding="utf-8") as f:
f.write(GITIGNORE_CONTENT)
CXX_FLAGS_SCRIPT = """# Auto-generated ESPHome script for C++ specific compiler flags
Import("env")
# Add C++ specific warning flags
env.Append(CXXFLAGS=["-Wno-volatile"])
"""
def write_cxx_flags_script() -> None:
path = CORE.relative_build_path("cxx_flags.py")
write_file_if_changed(path, CXX_FLAGS_SCRIPT)