From 461b0bf0910f061ee7871f0c9902981f9c1023d6 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 18 Nov 2015 09:59:11 +1000 Subject: [PATCH] More compiler specific stuff --- gfx.h | 64 ++++++++++++++++++++++++++++--------------- src/gmisc/gmisc.h | 2 +- src/gwin/gwin_class.h | 4 --- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/gfx.h b/gfx.h index 0727bf99..12794355 100644 --- a/gfx.h +++ b/gfx.h @@ -38,19 +38,6 @@ #define TRUE -1 #endif -/** - * @brief Mark a function as deprecated. - */ -#ifndef DEPRECATED - #if defined(__GNUC__) || defined(__MINGW32_) || defined(__CYGWIN__) - #define DEPRECATED(msg) __attribute__((deprecated(msg))) - #elif defined(_MSC_VER) - #define DEPRECATED(msg) __declspec(deprecated(msg)) - #else - #define DEPRECATED(msg) - #endif -#endif - /* gfxconf.h is the user's project configuration for the GFX system. */ #include "gfxconf.h" @@ -277,7 +264,12 @@ /** @} */ -/* Try to auto-detect some stuff from the compiler itself */ +/* Set some defaults */ +#if GFX_NO_INLINE + #define GFXINLINE +#endif + +/* Try to auto-detect the compiler */ #if GFX_COMPILER == GFX_COMPILER_UNKNOWN #undef GFX_COMPILER #if defined(__MINGW32__) @@ -348,6 +340,28 @@ #define GFX_COMPILER GFX_COMPILER_UNKNOWN #endif #endif + +/* Compiler specific defines */ +#if GFX_COMPILER == GFX_COMPILER_KEIL + #define DEPRECATED(msg) __attribute__((deprecated(msg))) + #pragma anon_unions // Allow anonymous unions + #pragma diag_remark 1293 // Turn off warning: assignment in condition + #pragma diag_remark 83 // Turn off warning: type qualifier specified more than once + #pragma diag_remark 767 // Turn off warning: conversion from pointer to smaller integer + #pragma diag_remark 188 // Turn off warning: enumerated type mixed with another type + #ifndef GFXINLINE // Get the Keil definition for inline + #define GFXINLINE __inline + #endif + #if !defined(__BIG_ENDIAN) && !defined(__LITTLE_ENDIAN) // Oops - Keil defines __BIG_ENDIAN or nothing + #define __LITTLE_ENDIAN + #endif +#elif GFX_COMPILER == GFX_COMPILER_MINGW32 || GFX_COMPILER == GFX_COMPILER_MINGW64 || GFX_COMPILER == GFX_COMPILER_CYGWIN || GFX_COMPILER == GFX_COMPILER_GCC + #define DEPRECATED(msg) __attribute__((deprecated(msg))) +#elif GFX_COMPILER == GFX_COMPILER_VS + #define DEPRECATED(msg) __declspec(deprecated(msg)) +#endif + +/* Try to auto-detect the cpu */ #if GFX_CPU == GFX_CPU_UNKNOWN #undef GFX_CPU #if defined(__ia64) || defined(__itanium__) || defined(_M_IA64) @@ -368,6 +382,8 @@ #define GFX_CPU GFX_CPU_UNKNOWN #endif #endif + +/* Try to auto-detect the endianness */ #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN #undef GFX_CPU_ENDIAN #if (defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) \ @@ -389,14 +405,18 @@ #endif #endif -#if GFX_NO_INLINE - #define GFXINLINE -#else - #if GFX_COMPILER == GFX_COMPILER_KEIL - #define GFXINLINE __inline - #else - #define GFXINLINE inline - #endif +/** + * @brief Mark a function as deprecated. + */ +#ifndef DEPRECATED + #define DEPRECATED(msg) +#endif + +/** + * @brief Mark a function as inline. + */ +#ifndef GFXINLINE + #define GFXINLINE inline #endif /** diff --git a/src/gmisc/gmisc.h b/src/gmisc/gmisc.h index ebef8156..09fce40f 100644 --- a/src/gmisc/gmisc.h +++ b/src/gmisc/gmisc.h @@ -76,7 +76,7 @@ typedef int32_t fixed; * @brief The famous number pi */ #ifndef PI -#define PI 3.1415926535897932384626433832795028841971693993751 + #define PI 3.1415926535897932384626433832795028841971693993751 #endif /** diff --git a/src/gwin/gwin_class.h b/src/gwin/gwin_class.h index 041c9152..f2aa4df0 100644 --- a/src/gwin/gwin_class.h +++ b/src/gwin/gwin_class.h @@ -23,10 +23,6 @@ #if GFX_USE_GWIN || defined(__DOXYGEN__) -#if GFX_COMPILER == GFX_COMPILER_KEIL - #pragma anon_unions -#endif - /** * @brief The predefined flags for a Window * @{