Skip to content

Commit de5a29c

Browse files
nicolovwjakob
authored andcommitted
Fix build with -Wmissing-prototypes (#1954)
When building with `-Werror,-Wmissing-prototypes`, `clang` complains about missing prototypes for functions defined through macro expansions. This PR adds the missing prototypes. ``` error: no previous prototype for function 'pybind11_init_impl_embedded' [ -Werror,-Wmissing-prototypes] PYBIND11_EMBEDDED_MODULE(embedded, mod) { ^ external/pybind11/include/pybind11/embed.h:61:5: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE' PYBIND11_EMBEDDED_MODULE_IMPL(name) \ ^ external/pybind11/include/pybind11/embed.h:26:23: note: expanded from macro 'PYBIND11_EMBEDDED_MODULE_IMPL' extern "C" void pybind11_init_impl_##name() { \ ^ <scratch space>:380:1: note: expanded from here pybind11_init_impl_embedded ^ 1 error generated. ```
1 parent dfde155 commit de5a29c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/pybind11/embed.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818

1919
#if PY_MAJOR_VERSION >= 3
2020
# define PYBIND11_EMBEDDED_MODULE_IMPL(name) \
21+
extern "C" PyObject *pybind11_init_impl_##name(); \
2122
extern "C" PyObject *pybind11_init_impl_##name() { \
2223
return pybind11_init_wrapper_##name(); \
2324
}
2425
#else
2526
# define PYBIND11_EMBEDDED_MODULE_IMPL(name) \
27+
extern "C" void pybind11_init_impl_##name(); \
2628
extern "C" void pybind11_init_impl_##name() { \
2729
pybind11_init_wrapper_##name(); \
2830
}

0 commit comments

Comments
 (0)