Skip to content

Commit c3415a9

Browse files
committed
Fold in changes from experimental PR pybind#5411. Polish error messages.
1 parent 0131c55 commit c3415a9

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

include/pybind11/detail/internals.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,25 @@ struct type_info {
310310
# endif
311311
#endif
312312

313-
/// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility.
314-
/// On MSVC, mixing /MT and /MD will result in crashes. See (#4953)
315313
#ifndef PYBIND11_BUILD_ABI
316-
# if defined(__GXX_ABI_VERSION)
314+
# if defined(__GXX_ABI_VERSION) // Linux/OSX.
317315
# define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION)
318-
# elif defined(_MSC_VER) && defined(_DLL) && defined(_MT)
319-
# if ((_MSC_VER) / 100 == 19)
320-
# define PYBIND11_BUILD_ABI "_md_mscver19"
316+
# elif defined(_MSC_VER) // See PR #4953.
317+
# if defined(_MT) && defined(_DLL)
318+
# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER)
319+
# elif defined(_MD)
320+
# if (_MSC_VER) / 100 == 19
321+
# define PYBIND11_BUILD_ABI "_md_mscver19"
322+
# else
323+
# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
324+
# endif
321325
# else
322-
# error "Unknown major version for MSC_VER"
326+
# error "Unknown combination of MSVC preprocessor macros: PLEASE REVISE THIS CODE."
323327
# endif
324-
# elif defined(_MSC_VER) && defined(_MT)
325-
# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_TOSTRING(_MSC_VER)
328+
# elif defined(__NVCOMPILER) // NVHPC (PGI-based, outdated).
329+
# define PYBIND11_BUILD_ABI "" // This was never properly guarded.
326330
# else
327-
# define PYBIND11_BUILD_ABI ""
331+
# error "Unknown platform or compiler: PLEASE REVISE THIS CODE."
328332
# endif
329333
#endif
330334

0 commit comments

Comments
 (0)