Commit d494fe63 authored by Dominik Charousset's avatar Dominik Charousset

Fix warnings on Clang

parent 6e514c60
...@@ -542,26 +542,16 @@ std::string to_string(const foo& x) { ...@@ -542,26 +542,16 @@ std::string to_string(const foo& x) {
} }
void register_class(foo*, pybind11::module& m, const std::string& name) { void register_class(foo*, pybind11::module& m, const std::string& name) {
std::string (*str_fun)(const foo&) = &to_string;
pybind11::class_<foo>(m, name.c_str()) pybind11::class_<foo>(m, name.c_str())
.def(pybind11::init<>()) .def(pybind11::init<>())
.def(pybind11::init<int, int>()) .def(pybind11::init<int, int>())
.def("__str__", (std::string (*)(const foo&)) &to_string) .def("__str__", str_fun)
.def("__repr__", (std::string (*)(const foo&)) &to_string) .def("__repr__", str_fun)
.def_readwrite("x", &foo::x) .def_readwrite("x", &foo::x)
.def_readwrite("y", &foo::y); .def_readwrite("y", &foo::y);
} }
class config : public py_config {
public:
std::string py_file;
config() {
add_message_type<foo>("foo");
opt_group{custom_options_, "python"}
.add(py_file, "file,f", "Run script instead of interactive shell.");
}
};
#if PY_MAJOR_VERSION == 3 #if PY_MAJOR_VERSION == 3
#define CAF_MODULE_INIT_RES PyObject* #define CAF_MODULE_INIT_RES PyObject*
#define CAF_MODULE_INIT_RET(res) return res; #define CAF_MODULE_INIT_RET(res) return res;
...@@ -570,7 +560,6 @@ public: ...@@ -570,7 +560,6 @@ public:
#define CAF_MODULE_INIT_RET(unused) #define CAF_MODULE_INIT_RET(unused)
#endif #endif
CAF_MODULE_INIT_RES caf_module_init() { CAF_MODULE_INIT_RES caf_module_init() {
pybind11::module m("CAF", "Python binding for CAF"); pybind11::module m("CAF", "Python binding for CAF");
s_context->cfg.py_init(m); s_context->cfg.py_init(m);
...@@ -592,6 +581,17 @@ namespace { ...@@ -592,6 +581,17 @@ namespace {
using namespace caf; using namespace caf;
using namespace caf::python; using namespace caf::python;
class config : public py_config {
public:
std::string py_file;
config() {
add_message_type<foo>("foo");
opt_group{custom_options_, "python"}
.add(py_file, "file,f", "Run script instead of interactive shell.");
}
};
void caf_main(actor_system& system, const config& cfg) { void caf_main(actor_system& system, const config& cfg) {
// register system and scoped actor in global variables // register system and scoped actor in global variables
scoped_actor self{system}; scoped_actor self{system};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment