Make warns.def and flags.def into a single opts.def.

This commit is contained in:
Dale Weiler 2012-11-10 21:13:09 +00:00
parent c155ef1582
commit 6b12f4435c
4 changed files with 72 additions and 44 deletions

View file

@ -1,8 +0,0 @@
#ifndef GMQCC_DEFINE_FLAG
#define GMQCC_DEFINE_FLAG(x)
#endif
GMQCC_DEFINE_FLAG(OVERLAP_LOCALS)
GMQCC_DEFINE_FLAG(DARKPLACES_STRING_TABLE_BUG)
GMQCC_DEFINE_FLAG(OMIT_NULL_BYTES)
GMQCC_DEFINE_FLAG(ADJUST_VECTOR_FIELDS)

27
gmqcc.h
View file

@ -193,7 +193,6 @@ 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_memory_r (void *, unsigned int, unsigned int, const char *);
void util_meminfo ();
bool util_strupper (const char *);
@ -215,13 +214,11 @@ uint16_t util_crc16(uint16_t crc, const char *data, size_t len);
uint32_t util_crc32(uint32_t crc, const char *data, size_t len);
#ifdef NOTRACK
# define mem_a(x) malloc(x)
# define mem_d(x) free (x)
# define mem_r(x,y) realloc((x),(y))
# define mem_a(x) malloc(x)
# define mem_d(x) free (x)
#else
# define mem_a(x) util_memory_a((x), __LINE__, __FILE__)
# define mem_d(x) util_memory_d((x), __LINE__, __FILE__)
# define mem_r(x,y) util_memory_r((x), (y), __LINE__, __FILE__)
# define mem_a(x) util_memory_a((x), __LINE__, __FILE__)
# define mem_d(x) util_memory_d((x), __LINE__, __FILE__)
#endif
/*
@ -974,28 +971,28 @@ typedef struct {
/*===================================================================*/
/* list of -f flags, like -fdarkplaces-string-table-bug */
enum {
# define GMQCC_TYPE_FLAGS
# define GMQCC_DEFINE_FLAG(X) X,
# include "flags.def"
# undef GMQCC_DEFINE_FLAG
# include "opts.def"
COUNT_FLAGS
};
static const opts_flag_def opts_flag_list[] = {
# define GMQCC_TYPE_FLAGS
# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(X) },
# include "flags.def"
# undef GMQCC_DEFINE_FLAG
# include "opts.def"
{ NULL, LONGBIT(0) }
};
enum {
# define GMQCC_TYPE_WARNS
# define GMQCC_DEFINE_FLAG(X) WARN_##X,
# include "warns.def"
# undef GMQCC_DEFINE_FLAG
# include "opts.def"
COUNT_WARNINGS
};
static const opts_flag_def opts_warn_list[] = {
# define GMQCC_TYPE_WARNS
# define GMQCC_DEFINE_FLAG(X) { #X, LONGBIT(WARN_##X) },
# include "warns.def"
# undef GMQCC_DEFINE_FLAG
# include "opts.def"
{ NULL, LONGBIT(0) }
};

60
opts.def Normal file
View file

@ -0,0 +1,60 @@
/*
* Copyright (C) 2012
* Wolfgang Bumiller
* Dale Weiler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef GMQCC_DEFINE_FLAG
# define GMQCC_DEFINE_FLAG(x)
#endif
/* codegen flags */
#ifdef GMQCC_TYPE_FLAGS
GMQCC_DEFINE_FLAG(OVERLAP_LOCALS)
GMQCC_DEFINE_FLAG(DARKPLACES_STRING_TABLE_BUG)
GMQCC_DEFINE_FLAG(OMIT_NULL_BYTES)
GMQCC_DEFINE_FLAG(ADJUST_VECTOR_FIELDS)
#endif
/* warning flags */
#ifdef GMQCC_TYPE_WARNS
GMQCC_DEFINE_FLAG(DEBUG)
GMQCC_DEFINE_FLAG(UNUSED_VARIABLE)
GMQCC_DEFINE_FLAG(USED_UNINITIALIZED)
GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE)
GMQCC_DEFINE_FLAG(EXTENSIONS)
GMQCC_DEFINE_FLAG(FIELD_REDECLARED)
GMQCC_DEFINE_FLAG(MISSING_RETURN_VALUES)
GMQCC_DEFINE_FLAG(TOO_FEW_PARAMETERS)
GMQCC_DEFINE_FLAG(LOCAL_SHADOWS)
GMQCC_DEFINE_FLAG(LOCAL_CONSTANTS)
GMQCC_DEFINE_FLAG(VOID_VARIABLES)
GMQCC_DEFINE_FLAG(IMPLICIT_FUNCTION_POINTER)
GMQCC_DEFINE_FLAG(VARIADIC_FUNCTION)
GMQCC_DEFINE_FLAG(FRAME_MACROS)
GMQCC_DEFINE_FLAG(EFFECTLESS_STATEMENT)
GMQCC_DEFINE_FLAG(END_SYS_FIELDS)
GMQCC_DEFINE_FLAG(ASSIGN_FUNCTION_TYPES)
#endif
/* some cleanup so we don't have to */
#undef GMQCC_TYPE_FLAGS
#undef GMQCC_TYPE_WARNS
#undef GMQCC_DEFINE_FLAG

View file

@ -1,21 +0,0 @@
#ifndef GMQCC_DEFINE_FLAG
#define GMQCC_DEFINE_FLAG(x)
#endif
GMQCC_DEFINE_FLAG(DEBUG)
GMQCC_DEFINE_FLAG(UNUSED_VARIABLE)
GMQCC_DEFINE_FLAG(USED_UNINITIALIZED)
GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE)
GMQCC_DEFINE_FLAG(EXTENSIONS)
GMQCC_DEFINE_FLAG(FIELD_REDECLARED)
GMQCC_DEFINE_FLAG(MISSING_RETURN_VALUES)
GMQCC_DEFINE_FLAG(TOO_FEW_PARAMETERS)
GMQCC_DEFINE_FLAG(LOCAL_SHADOWS)
GMQCC_DEFINE_FLAG(LOCAL_CONSTANTS)
GMQCC_DEFINE_FLAG(VOID_VARIABLES)
GMQCC_DEFINE_FLAG(IMPLICIT_FUNCTION_POINTER)
GMQCC_DEFINE_FLAG(VARIADIC_FUNCTION)
GMQCC_DEFINE_FLAG(FRAME_MACROS)
GMQCC_DEFINE_FLAG(EFFECTLESS_STATEMENT)
GMQCC_DEFINE_FLAG(END_SYS_FIELDS)
GMQCC_DEFINE_FLAG(ASSIGN_FUNCTION_TYPES)