After I produced the bindings files, I now tried to compile everything, but there are a couple of problems. I am not entirely sure yet where they come from - my part, Pybind, or Binder. It seems, the latter, so I'm opening this issue.
Clang 3.9.1, WARN_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -pedantic -pedantic-errors"
In file included from [...]/src/placement/function/functions_1.cpp:23:
In file included from [...]/pybind11/include/pybind11/pybind11.h:36:
In file included from [...]/pybind11/include/pybind11/attr.h:13:
[...]/pybind11/include/pybind11/cast.h:961:79: error: token pasting of ',' and __VA_ARGS__ is a GNU
extension [-Werror,-Wgnu-zero-variadic-macro-arguments]
struct always_construct_holder<holder_type> : always_construct_holder<void, ##__VA_ARGS__> { }; \
^
[...]/pybind11/include/pybind11/cast.h:961:79: error: token pasting of ',' and __VA_ARGS__ is a GNU
extension [-Werror,-Wgnu-zero-variadic-macro-arguments]
...
The first line functions_1.cpp:23
is simply #include <pybind11/pybind11.h>
.
The warning comes from a GNU extension. The interesting part is that all the includes (attr.h
, cast.h
) are part of the pybind header. So they should also happen when I try the minimal example of Pybind - but there, I don't get any errors. The minimal example works for me.
So, I tried to disable the warnings by leaving out the pedantic
flag. But then, other errors occur:
Clang 3.9.1, WARN_FLAGS "-Wall -Wextra -Wno-unknown-pragmas"
In file included from [...]/src/placement/function/helper.cpp:1:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable_policy.h:34:15: error: expected '{'
namespace std _GLIBCXX_VISIBILITY(default)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable_policy.h:34:15: error: C++ requires a type
specifier for all declarations
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable_policy.h:34:35: error: expected expression
namespace std _GLIBCXX_VISIBILITY(default)
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable_policy.h:34:43: error: expected ';' after top
level declarator
namespace std _GLIBCXX_VISIBILITY(default)
^
...
Here, the first line helper.cpp:1
is #include <bits/hashtable_policy.h>
.
It seems a bit weird to me that Binder directly includes bits
headers instead of using the "clean" names of those headers. But maybe this is needed. Anyway, does not seem to work, so I tried GCC instead.
GNU 4.9.4, WARN_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -pedantic -pedantic-errors"
[...]/src/placement/function/functions_1.cpp:27:52: error: ISO C99 requires rest arguments to be used
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
^
[...]/src/placement/function/functions_1.cpp:28:36: error: ISO C99 requires rest arguments to be used
PYBIND11_DECLARE_HOLDER_TYPE(T, T*);
^
[...]/src/placement/function/functions_1.cpp:27:53: error: extra ‘;’ [-Wpedantic]
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
^
[...]/src/placement/function/functions_1.cpp:28:37: error: extra ‘;’ [-Wpedantic]
PYBIND11_DECLARE_HOLDER_TYPE(T, T*);
^
...
The line that is causing this is the definition PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
, as part of the #ifndef BINDER_PYBIND11_TYPE_CASTER
block. So, this seems to be a similar problem as the first one with Clang. Next, naturally, I tried again without pedantic:
GNU 4.9.4, WARN_FLAGS "-Wall -Wextra -Wno-unknown-pragmas"
In file included from [...]/src/placement/function/helper.cpp:1:0:
/usr/include/c++/4.9/bits/hashtable_policy.h:34:15: error: expected ‘{’ before ‘_GLIBCXX_VISIBILITY’
namespace std _GLIBCXX_VISIBILITY(default)
^
/usr/include/c++/4.9/bits/hashtable_policy.h:34:34: error: expected constructor, destructor, or type conversion before ‘(’ token
namespace std _GLIBCXX_VISIBILITY(default)
^
In file included from /usr/include/c++/4.9/typeinfo:34:0,
from /usr/include/c++/4.9/debug/formatter.h:34,
from /usr/include/c++/4.9/debug/functions.h:41,
from /usr/include/c++/4.9/debug/debug.h:127,
from /usr/include/c++/4.9/bits/unique_ptr.h:34,
from [...]/src/placement/function/helper.cpp:2:
/usr/include/c++/4.9/exception:35:37: error: expected ‘}’ before end of line
#pragma GCC visibility push(default)
^
...
Similar to the second Clang problem.
Any help is appreciated. What is going on here? Thanks in advance!