Skip to content

Commit

Permalink
sync dmlc header
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Aug 26, 2016
1 parent 7e15fdd commit cd1db1a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions include/dmlc/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -69,6 +74,7 @@
#endif
#endif


/*!
* \brief Enable std::thread related modules,
* Used to disable some module in mingw compile.
Expand All @@ -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.
*
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
/*!
Expand Down

0 comments on commit cd1db1a

Please sign in to comment.