More compiler specific stuff

This commit is contained in:
inmarket 2015-11-18 09:59:11 +10:00
parent 45174c4092
commit 461b0bf091
3 changed files with 43 additions and 27 deletions

62
gfx.h
View File

@ -38,19 +38,6 @@
#define TRUE -1 #define TRUE -1
#endif #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. */ /* gfxconf.h is the user's project configuration for the GFX system. */
#include "gfxconf.h" #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 #if GFX_COMPILER == GFX_COMPILER_UNKNOWN
#undef GFX_COMPILER #undef GFX_COMPILER
#if defined(__MINGW32__) #if defined(__MINGW32__)
@ -348,6 +340,28 @@
#define GFX_COMPILER GFX_COMPILER_UNKNOWN #define GFX_COMPILER GFX_COMPILER_UNKNOWN
#endif #endif
#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 #if GFX_CPU == GFX_CPU_UNKNOWN
#undef GFX_CPU #undef GFX_CPU
#if defined(__ia64) || defined(__itanium__) || defined(_M_IA64) #if defined(__ia64) || defined(__itanium__) || defined(_M_IA64)
@ -368,6 +382,8 @@
#define GFX_CPU GFX_CPU_UNKNOWN #define GFX_CPU GFX_CPU_UNKNOWN
#endif #endif
#endif #endif
/* Try to auto-detect the endianness */
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN
#undef GFX_CPU_ENDIAN #undef GFX_CPU_ENDIAN
#if (defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) \ #if (defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) \
@ -389,14 +405,18 @@
#endif #endif
#endif #endif
#if GFX_NO_INLINE /**
#define GFXINLINE * @brief Mark a function as deprecated.
#else */
#if GFX_COMPILER == GFX_COMPILER_KEIL #ifndef DEPRECATED
#define GFXINLINE __inline #define DEPRECATED(msg)
#else #endif
/**
* @brief Mark a function as inline.
*/
#ifndef GFXINLINE
#define GFXINLINE inline #define GFXINLINE inline
#endif
#endif #endif
/** /**

View File

@ -76,7 +76,7 @@ typedef int32_t fixed;
* @brief The famous number pi * @brief The famous number pi
*/ */
#ifndef PI #ifndef PI
#define PI 3.1415926535897932384626433832795028841971693993751 #define PI 3.1415926535897932384626433832795028841971693993751
#endif #endif
/** /**

View File

@ -23,10 +23,6 @@
#if GFX_USE_GWIN || defined(__DOXYGEN__) #if GFX_USE_GWIN || defined(__DOXYGEN__)
#if GFX_COMPILER == GFX_COMPILER_KEIL
#pragma anon_unions
#endif
/** /**
* @brief The predefined flags for a Window * @brief The predefined flags for a Window
* @{ * @{