[core] Don't issue -Wno-volatile for host platform (#9511)

This commit is contained in:
Clyde Stubbs 2025-07-15 16:59:20 +10:00 committed by GitHub
parent b959baf3d6
commit 3f492e3b82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -163,7 +163,7 @@ def get_ini_content():
CORE.add_platformio_option("build_unflags", sorted(CORE.build_unflags)) CORE.add_platformio_option("build_unflags", sorted(CORE.build_unflags))
# Add extra script for C++ flags # Add extra script for C++ flags
CORE.add_platformio_option("extra_scripts", ["pre:cxx_flags.py"]) CORE.add_platformio_option("extra_scripts", [f"pre:{CXX_FLAGS_FILE_NAME}"])
content = "[platformio]\n" content = "[platformio]\n"
content += f"description = ESPHome {__version__}\n" content += f"description = ESPHome {__version__}\n"
@ -402,14 +402,18 @@ def write_gitignore():
f.write(GITIGNORE_CONTENT) f.write(GITIGNORE_CONTENT)
CXX_FLAGS_SCRIPT = """# Auto-generated ESPHome script for C++ specific compiler flags CXX_FLAGS_FILE_NAME = "cxx_flags.py"
CXX_FLAGS_FILE_CONTENTS = """# Auto-generated ESPHome script for C++ specific compiler flags
Import("env") Import("env")
# Add C++ specific warning flags # Add C++ specific flags
env.Append(CXXFLAGS=["-Wno-volatile"])
""" """
def write_cxx_flags_script() -> None: def write_cxx_flags_script() -> None:
path = CORE.relative_build_path("cxx_flags.py") path = CORE.relative_build_path(CXX_FLAGS_FILE_NAME)
write_file_if_changed(path, CXX_FLAGS_SCRIPT) contents = CXX_FLAGS_FILE_CONTENTS
if not CORE.is_host:
contents += 'env.Append(CXXFLAGS=["-Wno-volatile"])'
contents += "\n"
write_file_if_changed(path, contents)