Permalink
Browse files

sync dmlc header

  • Loading branch information...
1 parent 7e15fdd commit cd1db1afaa3678e314c50339922f3beaa3068aba @tqchen tqchen committed Aug 26, 2016
Showing with 34 additions and 0 deletions.
  1. +34 −0 include/dmlc/base.h
View
@@ -58,6 +58,11 @@
__cplusplus >= 201103L || defined(_MSC_VER))
#endif
+/*! \brief strict CXX11 support */
+#ifndef DMLC_STRICT_CXX11
+#define DMLC_STRICT_CXX11 (__cplusplus >= 201103L || defined(_MSC_VER))
+#endif
+
/// check if g++ is before 4.6
#if DMLC_USE_CXX11 && defined(__GNUC__) && !defined(__clang_version__)
#if __GNUC__ == 4 && __GNUC_MINOR__ < 6
@@ -69,6 +74,7 @@
#endif
#endif
+
/*!
* \brief Enable std::thread related modules,
* Used to disable some module in mingw compile.
@@ -82,6 +88,17 @@
#define DMLC_USE_REGEX (__cplusplus >= 201103L || defined(_MSC_VER))
#endif
+/*! \brief helper macro to supress unused warning */
+#if defined(__GNUC__)
+#define DMLC_ATTRIBUTE_UNUSED __attribute__((unused))
+#else
+#define DMLC_ATTRIBUTE_UNUSED
+#endif
+
+/*! \brief helper macro to generate string concat */
+#define DMLC_STR_CONCAT_(__x, __y) __x##__y
+#define DMLC_STR_CONCAT(__x, __y) DMLC_STR_CONCAT_(__x, __y)
+
/*!
* \brief Disable copy constructor and assignment operator.
*
@@ -110,6 +127,9 @@
#if !defined(__GNUC__)
#define fopen64 std::fopen
#endif
+#if (defined __MINGW32__) && !(defined __MINGW64__)
+#define fopen64 std::fopen
+#endif
#ifdef _MSC_VER
#if _MSC_VER < 1900
// NOTE: sprintf_s is not equivalent to snprintf,
@@ -151,6 +171,20 @@ typedef unsigned __int64 uint64_t;
#include <string>
#include <vector>
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define noexcept_true throw ()
+#define noexcept_false
+#define noexcept(a) noexcept_##a
+#endif
+
+#if DMLC_USE_CXX11
+#define DMLC_THROW_EXCEPTION noexcept(false)
+#define DMLC_NO_EXCEPTION noexcept(true)
+#else
+#define DMLC_THROW_EXCEPTION
+#define DMLC_NO_EXCEPTION
+#endif
+
/*! \brief namespace for dmlc */
namespace dmlc {
/*!

0 comments on commit cd1db1a

Please sign in to comment.