From 47b8c1431a72a8e54970ca2e69c71c111202cdab Mon Sep 17 00:00:00 2001 From: James Morris Date: Thu, 28 Nov 2024 16:01:46 -0500 Subject: [PATCH] fix: ignore -Wgnu-zero-variadic-macro-arguments on clang --- pybind11/setup_helpers.py | 2 +- tests/CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pybind11/setup_helpers.py b/pybind11/setup_helpers.py index f24291818c..c36c186db7 100644 --- a/pybind11/setup_helpers.py +++ b/pybind11/setup_helpers.py @@ -149,7 +149,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: if WIN: cflags += ["/EHsc", "/bigobj"] else: - cflags += ["-fvisibility=hidden"] + cflags += ["-fvisibility=hidden", "-Wno-gnu-zero-variadic-macro-arguments"] env_cflags = os.environ.get("CFLAGS", "") env_cppflags = os.environ.get("CPPFLAGS", "") c_cpp_flags = shlex.split(env_cflags) + shlex.split(env_cppflags) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01b6c0a3e6..779adbc9cf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -389,6 +389,9 @@ function(pybind11_enable_warnings target_name) if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 20) target_compile_options(${target_name} PRIVATE -Wpedantic) endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(${target_name} PRIVATE -Wno-gnu-zero-variadic-macro-arguments) + endif() endif() if(PYBIND11_WERROR)