From 0c5f2b9409cbb2f554aa28cc011ecc637ccf9902 Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 1 Sep 2014 17:15:04 -0700 Subject: [PATCH 1/2] gard GNU c --- Makefile | 2 +- src/utils/utils.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2fd881843..c7524747c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ export CC = gcc -export CXX = g++ +export CXX = clang++ export LDFLAGS= -pthread -lm export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -pedantic -ansi diff --git a/src/utils/utils.h b/src/utils/utils.h index 1214be861..49bd36819 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -10,8 +10,10 @@ #include #include #include -#ifdef _MSC_VER +#if !defined(__GNUC__) #define fopen64 fopen +#endif +#ifdef _MSC_VER // NOTE: sprintf_s is not equivalent to snprintf, // they are equivalent when success, which is sufficient for our case #define snprintf sprintf_s From 0d5debcc25f6c5fc43486c981b1b754c8f2e212f Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 1 Sep 2014 17:23:44 -0700 Subject: [PATCH 2/2] fine fix --- Makefile | 2 +- src/utils/utils.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c7524747c..2fd881843 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ export CC = gcc -export CXX = clang++ +export CXX = g++ export LDFLAGS= -pthread -lm export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -pedantic -ansi diff --git a/src/utils/utils.h b/src/utils/utils.h index 49bd36819..56a957df9 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -7,9 +7,13 @@ */ #define _CRT_SECURE_NO_WARNINGS #include -#include #include #include + +#ifndef XGBOOST_STRICT_CXX98_ +#include +#endif + #if !defined(__GNUC__) #define fopen64 fopen #endif @@ -72,7 +76,7 @@ inline void HandlePrint(const char *msg) { printf("%s", msg); } #else -#ifndef XGBOOST_STRICT_CXX98__ +#ifndef XGBOOST_STRICT_CXX98_ // include declarations, some one must implement this void HandleAssertError(const char *msg); void HandleCheckError(const char *msg);