mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
203cc26f5b
* Add test_namespace_visibility To probe environment/toolchain/platform-specific behavior under the exact same conditions as normal tests. (An earlier version of this code was used to inform PR #4043.) * Disable flake8 in ubench/holder_comparison_*.py, to suppress new & useless diagnostics. * Disable namespace_visibility_1s.cpp (tosee if that resolves the MSVC and CUDA `test_cross_module_exception_translator` failures). * Turn off flake8 completely for ubench (the Strip unnecessary `# noqa`s action un-helpfully removed the added noqa). * Disable test_namespace_visibility completely. Just keep the two .cpp files, only setting the module docstring and doing nothing else. * Rename test_namespace_visibility.py to test_exc_namespace_visibility.py, so that it is imported by pytest before test_exceptions.py * Add `set_property(SOURCE namespace_visibility_1s.cpp PROPERTY LANGUAGE CUDA)` * Add reference to PR #4054 * Complete the documentation (comments in test_exc_namespace_visibility.py). * Rename namespace_visibility.h to namespace_visibility.inl, as suggested by @charlesbeattie
32 lines
1.6 KiB
C++
32 lines
1.6 KiB
C++
// Copyright (c) 2022 The Pybind Development Team.
|
|
// All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
|
|
#ifdef __GNUG__
|
|
# define PYBIND11_NS_VIS_U /* unspecified */
|
|
# define PYBIND11_NS_VIS_H __attribute__((visibility("hidden")))
|
|
#else
|
|
# define PYBIND11_NS_VIS_U
|
|
# define PYBIND11_NS_VIS_H
|
|
#endif
|
|
|
|
#define PYBIND11_NS_VIS_FUNC \
|
|
inline std::ptrdiff_t func() { \
|
|
static std::ptrdiff_t value = 0; \
|
|
return reinterpret_cast<std::ptrdiff_t>(&value); \
|
|
}
|
|
|
|
#define PYBIND11_NS_VIS_DEFS \
|
|
m.def("ns_vis_uuu_func", pybind11_ns_vis_uuu::func); \
|
|
m.def("ns_vis_uuh_func", pybind11_ns_vis_uuh::func); \
|
|
m.def("ns_vis_uhu_func", pybind11_ns_vis_uhu::func); \
|
|
m.def("ns_vis_uhh_func", pybind11_ns_vis_uhh::func); \
|
|
m.def("ns_vis_huu_func", pybind11_ns_vis_huu::func); \
|
|
m.def("ns_vis_huh_func", pybind11_ns_vis_huh::func); \
|
|
m.def("ns_vis_hhu_func", pybind11_ns_vis_hhu::func); \
|
|
m.def("ns_vis_hhh_func", pybind11_ns_vis_hhh::func);
|