mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
Cleanup of osdcomm.h (nw)
This commit is contained in:
parent
700683468a
commit
1d40aecb58
@ -27,7 +27,10 @@
|
|||||||
// define this to zap memory to a fixed non-0 value before freeing
|
// define this to zap memory to a fixed non-0 value before freeing
|
||||||
//#define OVERWRITE_FREED_MEMORY
|
//#define OVERWRITE_FREED_MEMORY
|
||||||
|
|
||||||
|
// compatibility with non-clang compilers
|
||||||
|
#ifndef __has_feature
|
||||||
|
#define __has_feature(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
COMPILER-SPECIFIC NASTINESS
|
COMPILER-SPECIFIC NASTINESS
|
||||||
@ -29,38 +29,23 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Some optimizations/warnings cleanups for GCC */
|
/* Some optimizations/warnings cleanups for GCC */
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
#if defined(__GNUC__)
|
||||||
#define ATTR_UNUSED __attribute__((__unused__))
|
#define ATTR_UNUSED __attribute__((__unused__))
|
||||||
#define ATTR_NORETURN __attribute__((noreturn))
|
#define ATTR_NORETURN __attribute__((noreturn))
|
||||||
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
|
#define ATTR_PRINTF(x,y) __attribute__((format(printf, x, y)))
|
||||||
#define ATTR_MALLOC __attribute__((malloc))
|
|
||||||
#define ATTR_PURE __attribute__((pure))
|
|
||||||
#define ATTR_CONST __attribute__((const))
|
#define ATTR_CONST __attribute__((const))
|
||||||
#define ATTR_FORCE_INLINE __attribute__((always_inline))
|
#define ATTR_FORCE_INLINE __attribute__((always_inline))
|
||||||
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||||
#define ATTR_DEPRECATED __attribute__((deprecated))
|
#define ATTR_DEPRECATED __attribute__((deprecated))
|
||||||
/* not supported in GCC prior to 4.4.x */
|
|
||||||
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)
|
|
||||||
#define ATTR_HOT __attribute__((hot))
|
#define ATTR_HOT __attribute__((hot))
|
||||||
#define ATTR_COLD __attribute__((cold))
|
#define ATTR_COLD __attribute__((cold))
|
||||||
#else
|
|
||||||
#define ATTR_HOT
|
|
||||||
#define ATTR_COLD
|
|
||||||
#endif
|
|
||||||
#define UNEXPECTED(exp) __builtin_expect(!!(exp), 0)
|
#define UNEXPECTED(exp) __builtin_expect(!!(exp), 0)
|
||||||
#define EXPECTED(exp) __builtin_expect(!!(exp), 1)
|
#define EXPECTED(exp) __builtin_expect(!!(exp), 1)
|
||||||
#define RESTRICT __restrict__
|
#define RESTRICT __restrict__
|
||||||
#define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(1)
|
|
||||||
#else
|
#else
|
||||||
#define ATTR_UNUSED
|
#define ATTR_UNUSED
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
|
||||||
#define ATTR_NORETURN __declspec(noreturn)
|
#define ATTR_NORETURN __declspec(noreturn)
|
||||||
#else
|
|
||||||
#define ATTR_NORETURN
|
|
||||||
#endif
|
|
||||||
#define ATTR_PRINTF(x,y)
|
#define ATTR_PRINTF(x,y)
|
||||||
#define ATTR_MALLOC
|
|
||||||
#define ATTR_PURE
|
|
||||||
#define ATTR_CONST
|
#define ATTR_CONST
|
||||||
#define ATTR_FORCE_INLINE __forceinline
|
#define ATTR_FORCE_INLINE __forceinline
|
||||||
#define ATTR_NONNULL(...)
|
#define ATTR_NONNULL(...)
|
||||||
@ -70,7 +55,6 @@
|
|||||||
#define UNEXPECTED(exp) (exp)
|
#define UNEXPECTED(exp) (exp)
|
||||||
#define EXPECTED(exp) (exp)
|
#define EXPECTED(exp) (exp)
|
||||||
#define RESTRICT
|
#define RESTRICT
|
||||||
#define SETJMP_GNUC_PROTECT() do {} while (0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -79,43 +63,28 @@
|
|||||||
FUNDAMENTAL TYPES
|
FUNDAMENTAL TYPES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* These types work on most modern compilers; however, OSD code can
|
|
||||||
define their own by setting OSD_TYPES_DEFINED */
|
|
||||||
|
|
||||||
#ifndef OSD_TYPES_DEFINED
|
|
||||||
|
|
||||||
/* 8-bit values */
|
/* 8-bit values */
|
||||||
typedef unsigned char UINT8;
|
using UINT8 = uint8_t;
|
||||||
typedef signed char INT8;
|
using INT8 = int8_t;
|
||||||
|
|
||||||
/* 16-bit values */
|
/* 16-bit values */
|
||||||
typedef unsigned short UINT16;
|
using UINT16 = uint16_t;
|
||||||
typedef signed short INT16;
|
using INT16 = int16_t;
|
||||||
|
|
||||||
/* 32-bit values */
|
/* 32-bit values */
|
||||||
#ifndef _WINDOWS_H
|
using UINT32 = uint32_t;
|
||||||
typedef unsigned int UINT32;
|
using INT32 = int32_t;
|
||||||
typedef signed int INT32;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 64-bit values */
|
/* 64-bit values */
|
||||||
#ifndef _WINDOWS_H
|
using UINT64 = uint64_t;
|
||||||
#ifdef _MSC_VER
|
using INT64 = int64_t;
|
||||||
typedef signed __int64 INT64;
|
|
||||||
typedef unsigned __int64 UINT64;
|
|
||||||
#else
|
|
||||||
__extension__ typedef unsigned long long UINT64;
|
|
||||||
__extension__ typedef signed long long INT64;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* pointer-sized values */
|
/* pointer-sized values */
|
||||||
#ifdef PTR64
|
#ifdef PTR64
|
||||||
typedef UINT64 FPTR;
|
using FPTR = uint64_t;
|
||||||
#else
|
#else
|
||||||
typedef UINT32 FPTR;
|
using FPTR = uint32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -165,7 +134,7 @@ typedef UINT32 FPTR;
|
|||||||
|
|
||||||
|
|
||||||
/* MINGW has adopted the MSVC formatting for 64-bit ints as of gcc 4.4 */
|
/* MINGW has adopted the MSVC formatting for 64-bit ints as of gcc 4.4 */
|
||||||
#if (defined(__MINGW32__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))) || defined(_MSC_VER)
|
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||||
#define I64FMT "I64"
|
#define I64FMT "I64"
|
||||||
#else
|
#else
|
||||||
#define I64FMT "ll"
|
#define I64FMT "ll"
|
||||||
@ -218,11 +187,6 @@ typedef UINT32 FPTR;
|
|||||||
#define LITTLE_ENDIANIZE_INT64(x) (FLIPENDIAN_INT64(x))
|
#define LITTLE_ENDIANIZE_INT64(x) (FLIPENDIAN_INT64(x))
|
||||||
#endif /* LSB_FIRST */
|
#endif /* LSB_FIRST */
|
||||||
|
|
||||||
// compatibility with non-clang compilers
|
|
||||||
#ifndef __has_feature
|
|
||||||
#define __has_feature(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
typedef ptrdiff_t ssize_t;
|
typedef ptrdiff_t ssize_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user