Skip to content

Commit 6a8463d

Browse files
committed
tests: only run pedantic in C++20 mode
Signed-off-by: Henry Schreiner <[email protected]>
1 parent ba93f53 commit 6a8463d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

include/pybind11/detail/common.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,6 @@ PYBIND11_WARNING_POP
479479
}
480480
481481
\endrst */
482-
PYBIND11_WARNING_PUSH
483-
PYBIND11_WARNING_DISABLE_GCC("-Wpedantic")
484-
PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")
485482
#define PYBIND11_MODULE(name, variable, ...) \
486483
static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \
487484
PYBIND11_MAYBE_UNUSED; \
@@ -502,7 +499,6 @@ PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arguments")
502499
PYBIND11_CATCH_INIT_EXCEPTIONS \
503500
} \
504501
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ & (variable))
505-
PYBIND11_WARNING_POP
506502

507503
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
508504

tests/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,14 @@ function(pybind11_enable_warnings target_name)
377377
${target_name}
378378
PRIVATE -Wall
379379
-Wextra
380-
-Wpedantic
381380
-Wconversion
382381
-Wcast-qual
383382
-Wdeprecated
384383
-Wundef
385384
-Wnon-virtual-dtor)
385+
if(DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD VERSION_LESS 20)
386+
target_compile_options(${target_name} PRIVATE -Wpedantic)
387+
endif()
386388
endif()
387389

388390
if(PYBIND11_WERROR)

0 commit comments

Comments
 (0)