Clean up doomtype.h a bit, add indenting and comments to make some preprocessor code more readable

This commit is contained in:
Monster Iestyn 2018-11-08 16:31:20 +00:00
parent 0bdbdd1b1e
commit 5c61c40551

View file

@ -44,12 +44,13 @@
typedef long ssize_t;
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
#define DWORD_PTR DWORD
#endif
#if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR)))
#define PDWORD_PTR PDWORD
#if (_MSC_VER <= 1200)
#ifndef DWORD_PTR
#define DWORD_PTR DWORD
#endif
#ifndef PDWORD_PTR
#define PDWORD_PTR PDWORD
#endif
#endif
#elif defined (_arch_dreamcast) // KOS Dreamcast
#include <arch/types.h>
@ -102,7 +103,7 @@ typedef long ssize_t;
#ifdef _MSC_VER
#if (_MSC_VER <= 1800) // MSVC 2013 and back
#define snprintf _snprintf
#if (_MSC_VER <= 1200) // MSVC 2012 and back
#if (_MSC_VER <= 1200) // MSVC 6.0 and back
#define vsnprintf _vsnprintf
#endif
#endif
@ -185,7 +186,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
//faB: clean that up !!
#if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward
#include "stdbool.h"
#include "stdbool.h"
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
#define false FALSE // use windows types
#define true TRUE
@ -275,58 +276,68 @@ typedef UINT32 tic_t;
#endif
#ifdef __GNUC__ // __attribute__ ((X))
#define FUNCNORETURN __attribute__ ((noreturn))
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__)
#include "inttypes.h"
#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
#define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn))
#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn))
#else
#define FUNCPRINTF __attribute__ ((format(printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
#endif
#else
#define FUNCPRINTF __attribute__ ((format(printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
#endif
#ifndef FUNCIERROR
#define FUNCIERROR __attribute__ ((noreturn))
#endif
#define FUNCMATH __attribute__((const))
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define FUNCDEAD __attribute__ ((deprecated))
#define FUNCINLINE __attribute__((always_inline))
#define FUNCNONNULL __attribute__((nonnull))
#endif
#define FUNCNOINLINE __attribute__((noinline))
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#ifdef __i386__ // i386 only
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
#endif
#endif
#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#define ATTRPACK __attribute__((packed, gcc_struct))
#else
#define ATTRPACK __attribute__((packed))
#endif
#define ATTRUNUSED __attribute__((unused))
#ifdef _XBOX
#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
#define XBOXSTATIC static
#endif
#define FUNCNORETURN __attribute__ ((noreturn))
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) // MinGW, >= GCC 4.1
#include "inttypes.h"
#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
#define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn))
#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
#define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn))
#else
#define FUNCPRINTF __attribute__ ((format(printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
#endif
#else
#define FUNCPRINTF __attribute__ ((format(printf, 1, 2)))
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
#endif
#ifndef FUNCIERROR
#define FUNCIERROR __attribute__ ((noreturn))
#endif
#define FUNCMATH __attribute__((const))
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) // >= GCC 3.1
#define FUNCDEAD __attribute__ ((deprecated))
#define FUNCINLINE __attribute__((always_inline))
#define FUNCNONNULL __attribute__((nonnull))
#endif
#define FUNCNOINLINE __attribute__((noinline))
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
#ifdef __i386__ // i386 only
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
#endif
#endif
#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) // MinGW, >= GCC 3.4
#define ATTRPACK __attribute__((packed, gcc_struct))
#else
#define ATTRPACK __attribute__((packed))
#endif
#define ATTRUNUSED __attribute__((unused))
// Xbox-only macros
#ifdef _XBOX
#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
#define XBOXSTATIC static
#endif
#elif defined (_MSC_VER)
#define ATTRNORETURN __declspec(noreturn)
#define ATTRINLINE __forceinline
#if _MSC_VER > 1200
#define ATTRNOINLINE __declspec(noinline)
#endif
#define ATTRNORETURN __declspec(noreturn)
#define ATTRINLINE __forceinline
#if _MSC_VER > 1200 // >= MSVC 6.0
#define ATTRNOINLINE __declspec(noinline)
#endif
#endif
#ifndef FUNCPRINTF