]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Use _MSVC_LANG to detect when "noexcept" can be used with MSVC.
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 9 Sep 2021 18:41:51 +0000 (21:41 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Thu, 9 Sep 2021 18:41:51 +0000 (21:41 +0300)
By default, MSVC always sets __cplusplus to 199711L. The real
C++ standard version is available in _MSVC_LANG (or one could
use /Zc:__cplusplus to set __cplusplus correctly).

Fixes <https://sourceforge.net/p/lzmautils/discussion/708858/thread/f6bc3b108a/>.

Thanks to Dan Weiss.

src/liblzma/api/lzma.h

index 122dab80d357d7b7fc9e23cf121821533afb04fa..8fbd9a874b32e713871e79213fad051215db0861 100644 (file)
  */
 #ifndef lzma_nothrow
 #      if defined(__cplusplus)
-#              if __cplusplus >= 201103L
+#              if __cplusplus >= 201103L || (defined(_MSVC_LANG) \
+                               && _MSVC_LANG >= 201103L)
 #                      define lzma_nothrow noexcept
 #              else
 #                      define lzma_nothrow throw()