X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=gmqcc.h;h=9d34199b7ad562191231010e46879d34337db8ed;hb=483ce89d78ce6e13ec217ba8caa503e2bb722bc4;hp=8c097672351ffb4cffa5a127c5788f450059cec3;hpb=b8d92dfa01aab1cf867d43a63b04eb7cc9e73e3a;p=xonotic%2Fgmqcc.git diff --git a/gmqcc.h b/gmqcc.h index 8c09767..9d34199 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -29,6 +29,17 @@ #include #include +/* + * Disable some over protective warnings in visual studio because fixing them is a waste + * of my time. + */ +#ifdef _MSC_VER +# pragma warning(disable : 4244 ) // conversion from 'int' to 'float', possible loss of data +# pragma warning(disable : 4018 ) // signed/unsigned mismatch +# pragma warning(disable : 4996 ) // This function or variable may be unsafe +# pragma warning(disable : 4700 ) // uninitialized local variable used +#endif + #define GMQCC_VERSION_MAJOR 0 #define GMQCC_VERSION_MINOR 1 #define GMQCC_VERSION_PATCH 0 @@ -135,31 +146,26 @@ #if INT_MAX == 0x7FFFFFFF typedef int int32_t; typedef unsigned int uint32_t; - typedef long int64_t; - typedef unsigned long uint64_t; #elif LONG_MAX == 0x7FFFFFFF typedef long int32_t; typedef unsigned long uint32_t; +#endif + +#if defined(__GNUC__) || defined (__CLANG__) + typedef int int64_t __attribute__((__mode__(__DI__))); + typedef unsigned int uint64_t __attribute__((__mode__(__DI__))); +#elif defined(_MSC_VER) + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +#else /* - * It's nearly impossible to figure out a 64bit type at - * this point without making assumptions about the build - * enviroment. So if clang or gcc is detected use some - * compiler builtins to create a 64 signed and unsigned - * type. - */ -# if defined(__GNUC__) || defined (__CLANG__) - typedef int int64_t __attribute__((__mode__(__DI__))); - typedef unsigned int uint64_t __attribute__((__mode__(__DI__))); -# else - /* - * Incoorectly size the types so static assertions below will - * fail. There is no valid way to get a 64bit type at this point - * without making assumptions of too many things. - */ - typedef struct { char _fail : 0; } int64_t; - typedef struct { char _fail : 0; } uint64_t; -# endif + * Incoorectly size the types so static assertions below will + * fail. There is no valid way to get a 64bit type at this point + * without making assumptions of too many things. + */ + typedef struct { char _fail : 0; } int64_t; + typedef struct { char _fail : 0; } uint64_t; #endif #ifdef _LP64 /* long pointer == 64 */ typedef unsigned long uintptr_t; @@ -175,7 +181,7 @@ typedef char uint32_size_is_correct [sizeof(uint32_t) == 4?1:-1]; typedef char uint64_size_is_correct [sizeof(uint64_t) == 8?1:-1]; typedef char int16_size_if_correct [sizeof(int16_t) == 2?1:-1]; typedef char int32_size_is_correct [sizeof(int32_t) == 4?1:-1]; -typedef char int64_size_is_correct [sizeof(int64_t) == 8?1:-1]; +typedef char int64_size_is_correct [sizeof(int64_t) >= 8?1:-1]; /* intptr_t / uintptr_t correct size check */ typedef char uintptr_size_is_correct[sizeof(intptr_t) == sizeof(int*)?1:-1]; typedef char intptr_size_is_correct [sizeof(uintptr_t)== sizeof(int*)?1:-1]; @@ -183,6 +189,8 @@ typedef char intptr_size_is_correct [sizeof(uintptr_t)== sizeof(int*)?1:-1]; /*===================================================================*/ /*=========================== util.c ================================*/ /*===================================================================*/ +FILE *util_fopen(const char *filename, const char *mode); + void *util_memory_a (unsigned int, unsigned int, const char *); void util_memory_d (void *, unsigned int, const char *); void util_meminfo (); @@ -777,7 +785,7 @@ enum store_types { }; typedef struct { - float x, y, z; + qcfloat x, y, z; } vector; vector vec3_add (vector, vector); @@ -985,6 +993,7 @@ extern int opts_standard; extern bool opts_debug; extern bool opts_memchk; extern bool opts_dump; +extern bool opts_werror; /*===================================================================*/ #define OPTS_FLAG(i) (!! (opts_flags[(i)/32] & (1<< ((i)%32))))