mirror of https://github.com/mamba-org/mamba.git
Include `path_caster.hpp` in all translation units to respect ODR
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
This commit is contained in:
parent
a89248c9b8
commit
0da1e5ef30
|
@ -4,28 +4,14 @@
|
|||
//
|
||||
// The full license is in the file LICENSE, distributed with this software.
|
||||
|
||||
#ifndef LIBMAMBAPY_PATH_CASTER_HPP
|
||||
#define LIBMAMBAPY_PATH_CASTER_HPP
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl/filesystem.h>
|
||||
|
||||
#include "mamba/fs/filesystem.hpp"
|
||||
|
||||
// The ODR warning occurs because pybind11's type_caster is defined in multiple translation units.
|
||||
// This is unavoidable because:
|
||||
//
|
||||
// 1. The `type_caster` specialization must be defined in a header file to be available to all
|
||||
// translation units
|
||||
// 2. pybind11's own type_caster is defined in `cast.h` which is included in multiple places
|
||||
// 3. We cannot make the specialization inline or move it to a source file without breaking
|
||||
// pybind11's type system.
|
||||
//
|
||||
// Therefore, we silence the warning as it's a false positive in this case -
|
||||
// the definitions are identical.
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wodr"
|
||||
#endif
|
||||
|
||||
namespace PYBIND11_NAMESPACE
|
||||
{
|
||||
namespace detail
|
||||
|
@ -37,6 +23,4 @@ namespace PYBIND11_NAMESPACE
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "bindings.hpp"
|
||||
#include "expected_caster.hpp"
|
||||
#include "flat_set_caster.hpp"
|
||||
#include "path_caster.hpp"
|
||||
#include "weakening_map_bind.hpp"
|
||||
|
||||
using OldVersionPart = std::vector<mamba::specs::VersionPartAtom>;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <pybind11/stl_bind.h>
|
||||
|
||||
#include "bind_utils.hpp"
|
||||
#include "path_caster.hpp"
|
||||
|
||||
namespace mambapy
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue