From d6138db85ae0f95f7fce99ba04a7b06c4779b953 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 Dec 2016 16:28:26 +0300 Subject: Fix compilation with cilk plus on gcc 6+. --- src/actions/actions.h | 4 ++-- src/localconsts.h | 20 +++++++++++++++----- src/logger.h | 26 +++++++++++++------------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/actions/actions.h b/src/actions/actions.h index 51c461953..85e2bde5a 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -81,9 +81,9 @@ namespace Actions decHandler(serverIgnoreAll); decHandler(serverUnIgnoreAll); decHandler(error) -#ifndef ENABLE_CILKPLUS +#ifndef BAD_CILKPLUS __attribute__ ((noreturn)) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS ; decHandler(dumpGraphics); decHandler(dumpEnvironment); diff --git a/src/localconsts.h b/src/localconsts.h index b76fe233f..00108b5eb 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -118,14 +118,24 @@ #endif // __clang__ #endif // __native_client__ -#ifndef ENABLE_CILKPLUS -#define A_CONST __attribute__ ((const)) -#define A_PURE __attribute__ ((pure)) -#define A_INLINE __attribute__ ((always_inline)) -#else // ENABLE_CILKPLUS +#ifdef ENABLE_CILKPLUS +#ifdef __GNUC__ +#if GCC_VERSION < 60000 +#define BAD_CILKPLUS +#else // GCC_VERSION < 60000 +#define GOOD_CILKPLUS +#endif // GCC_VERSION < 60000 +#endif // __GNUC__ +#endif // ENABLE_CILKPLUS + +#if defined(ENABLE_CILKPLUS) && defined(BAD_CILKPLUS) #define A_CONST #define A_PURE #define A_INLINE +#else // ENABLE_CILKPLUS +#define A_CONST __attribute__ ((const)) +#define A_PURE __attribute__ ((pure)) +#define A_INLINE __attribute__ ((always_inline)) #endif // ENABLE_CILKPLUS #ifdef __INTEL_COMPILER diff --git a/src/logger.h b/src/logger.h index 10b0bcf4a..be49bb74f 100644 --- a/src/logger.h +++ b/src/logger.h @@ -105,12 +105,12 @@ class Logger final __attribute__((__format__(printf, 2, 3))) #else // __OpenBSD__ -#ifdef ENABLE_CILKPLUS +#ifdef BAD_CILKPLUS __attribute__((__format__(gnu_printf, 1, 2))) -#else // ENABLE_CILKPLUS +#else // BAD_CILKPLUS __attribute__((__format__(gnu_printf, 2, 3))) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS #endif // __OpenBSD__ #endif // __GNUC__ @@ -126,12 +126,12 @@ class Logger final __attribute__((__format__(printf, 2, 3))) #else // __OpenBSD__ -#ifdef ENABLE_CILKPLUS +#ifdef BAD_CILKPLUS __attribute__((__format__(gnu_printf, 1, 2))) -#else // ENABLE_CILKPLUS +#else // BAD_CILKPLUS __attribute__((__format__(gnu_printf, 2, 3))) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS #endif // __OpenBSD__ #endif // __GNUC__ @@ -146,12 +146,12 @@ class Logger final __attribute__((__format__(printf, 2, 3))) #else // __OpenBSD__ -#ifdef ENABLE_CILKPLUS +#ifdef BAD_CILKPLUS __attribute__((__format__(gnu_printf, 1, 2))) -#else // ENABLE_CILKPLUS +#else // BAD_CILKPLUS __attribute__((__format__(gnu_printf, 2, 3))) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS #endif // __OpenBSD__ #endif // __GNUC__ @@ -191,9 +191,9 @@ class Logger final * will be printed to standard error everywhere else. */ void error(const std::string &error_text) -#ifndef ENABLE_CILKPLUS +#ifndef BAD_CILKPLUS __attribute__ ((noreturn)) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS ; /** @@ -201,9 +201,9 @@ class Logger final * will be printed to standard error everywhere else. */ void safeError(const std::string &error_text) -#ifndef ENABLE_CILKPLUS +#ifndef BAD_CILKPLUS __attribute__ ((noreturn)) -#endif // ENABLE_CILKPLUS +#endif // BAD_CILKPLUS ; void unimplemented(const int id); -- cgit v1.2.3-60-g2f50