replace COMPILE_TIME_ASSERT with _Static_assert
parent
3bbba8adce
commit
d03dd0c701
|
@ -154,7 +154,6 @@ set(srcs
|
|||
source/wad.h
|
||||
source/world.c
|
||||
source/world.h
|
||||
source/wsaerror.h
|
||||
source/zone.c
|
||||
source/zone.h)
|
||||
|
||||
|
@ -166,7 +165,8 @@ if(WIN32)
|
|||
source/net_wipx.c
|
||||
source/net_wipx.h
|
||||
source/pl_win.c
|
||||
source/sys_sdl_win.c)
|
||||
source/sys_sdl_win.c
|
||||
source/wsaerror.h)
|
||||
else()
|
||||
list(APPEND srcs
|
||||
source/net_bsd.c
|
||||
|
|
|
@ -81,8 +81,8 @@ typedef int socklen_t; /* defining as signed int to match the old api */
|
|||
|
||||
#define socketerror(x) strerror((x))
|
||||
|
||||
/* Verify that we defined HAVE_SA_LEN correctly: */
|
||||
COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET);
|
||||
_Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET,
|
||||
"HAVE_SA_LEN not defined correctly");
|
||||
|
||||
#endif /* end of unix stuff */
|
||||
|
||||
|
@ -133,8 +133,8 @@ typedef unsigned int in_addr_t; /* u_int32_t */
|
|||
/* there is h_errno but no hstrerror() */
|
||||
#define hstrerror(x) strerror((x))
|
||||
|
||||
/* Verify that we defined HAVE_SA_LEN correctly: */
|
||||
COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET);
|
||||
_Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET,
|
||||
"HAVE_SA_LEN not defined correctly");
|
||||
|
||||
#endif /* end of amiga bsdsocket.library stuff */
|
||||
|
||||
|
@ -170,8 +170,8 @@ typedef SOCKET sys_socket_t;
|
|||
/* must #include "wsaerror.h" for this : */
|
||||
#define socketerror(x) __WSAE_StrError((x))
|
||||
|
||||
/* Verify that we defined HAVE_SA_LEN correctly: */
|
||||
COMPILE_TIME_ASSERT(sockaddr, offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET);
|
||||
_Static_assert(offsetof(struct sockaddr, sa_family) == SA_FAM_OFFSET,
|
||||
"HAVE_SA_LEN not defined correctly");
|
||||
|
||||
#endif /* end of windows stuff */
|
||||
|
||||
|
|
|
@ -67,14 +67,6 @@
|
|||
|
||||
/*==========================================================================*/
|
||||
|
||||
#ifndef NULL
|
||||
#if defined(__cplusplus)
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Q_MAXCHAR ((char)0x7f)
|
||||
#define Q_MAXSHORT ((short)0x7fff)
|
||||
#define Q_MAXINT ((int)0x7fffffff)
|
||||
|
@ -90,20 +82,17 @@
|
|||
/* Make sure the types really have the right
|
||||
* sizes: These macros are from SDL headers.
|
||||
*/
|
||||
#define COMPILE_TIME_ASSERT(name, x) \
|
||||
typedef int dummy_ ## name[(x) * 2 - 1]
|
||||
|
||||
COMPILE_TIME_ASSERT(char, sizeof(char) == 1);
|
||||
COMPILE_TIME_ASSERT(float, sizeof(float) == 4);
|
||||
COMPILE_TIME_ASSERT(long, sizeof(long) >= 4);
|
||||
COMPILE_TIME_ASSERT(int, sizeof(int) == 4);
|
||||
COMPILE_TIME_ASSERT(short, sizeof(short) == 2);
|
||||
_Static_assert(sizeof(char) == 1, "char not correct size");
|
||||
_Static_assert(sizeof(float) == 4, "float not correct size");
|
||||
_Static_assert(sizeof(long) >= 4, "long not correct size");
|
||||
_Static_assert(sizeof(int) == 4, "int not correct size");
|
||||
_Static_assert(sizeof(short) == 2, "short not correct size");
|
||||
|
||||
/* make sure enums are the size of ints for structure packing */
|
||||
typedef enum {
|
||||
THE_DUMMY_VALUE
|
||||
} THE_DUMMY_ENUM;
|
||||
COMPILE_TIME_ASSERT(enum, sizeof(THE_DUMMY_ENUM) == sizeof(int));
|
||||
_Static_assert(sizeof(THE_DUMMY_ENUM) == sizeof(int), "enum not sizeof(int)");
|
||||
|
||||
|
||||
/* Provide a substitute for offsetof() if we don't have one.
|
||||
|
@ -118,24 +107,10 @@ COMPILE_TIME_ASSERT(enum, sizeof(THE_DUMMY_ENUM) == sizeof(int));
|
|||
|
||||
typedef unsigned char byte;
|
||||
|
||||
#undef true
|
||||
#undef false
|
||||
#if defined(__cplusplus)
|
||||
/* some structures have qboolean members and the x86 asm code expect
|
||||
* those members to be 4 bytes long. therefore, qboolean must be 32
|
||||
* bits and it can NOT be binary compatible with the 8 bit C++ bool. */
|
||||
typedef int qboolean;
|
||||
COMPILE_TIME_ASSERT(falsehood, (0 == false));
|
||||
COMPILE_TIME_ASSERT(truth, (1 == true));
|
||||
#else
|
||||
typedef enum {
|
||||
false = 0,
|
||||
true = 1
|
||||
} qboolean;
|
||||
COMPILE_TIME_ASSERT(falsehood, ((1 != 1) == false));
|
||||
COMPILE_TIME_ASSERT(truth, ((1 == 1) == true));
|
||||
#endif
|
||||
COMPILE_TIME_ASSERT(qboolean, sizeof(qboolean) == 4);
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ struct upkg_hdr {
|
|||
#define UPKG_HDR_SIZE 64 /* 64 bytes up until here */
|
||||
/*struct _genhist *gen;*/
|
||||
};
|
||||
/*COMPILE_TIME_ASSERT(upkg_hdr, offsetof(struct upkg_hdr, gen) == UPKG_HDR_SIZE);*/
|
||||
COMPILE_TIME_ASSERT(upkg_hdr, sizeof(struct upkg_hdr) == UPKG_HDR_SIZE);
|
||||
_Static_assert(sizeof(struct upkg_hdr) == UPKG_HDR_SIZE,
|
||||
"upkg_hdr not correct size");
|
||||
|
||||
#define UMUSIC_IT 0
|
||||
#define UMUSIC_S3M 1
|
||||
|
|
Loading…
Reference in New Issue