]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Make warns.def and flags.def into a single opts.def.
authorDale Weiler <killfieldengine@gmail.com>
Sat, 10 Nov 2012 21:13:09 +0000 (21:13 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 10 Nov 2012 21:13:09 +0000 (21:13 +0000)
flags.def [deleted file]
gmqcc.h
opts.def [new file with mode: 0644]
warns.def [deleted file]

diff --git a/flags.def b/flags.def
deleted file mode 100644 (file)
index 79ab71e..0000000
--- a/flags.def
+++ /dev/null
@@ -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)
diff --git a/gmqcc.h b/gmqcc.h
index e32943d5e35baa08c1e450004a86e7eaddf62efd..bf3c7c664beb1658ec27c54dcefc80e6e9cdd55e 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -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) }
 };
 
diff --git a/opts.def b/opts.def
new file mode 100644 (file)
index 0000000..e628f43
--- /dev/null
+++ b/opts.def
@@ -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
diff --git a/warns.def b/warns.def
deleted file mode 100644 (file)
index adcc98d..0000000
--- a/warns.def
+++ /dev/null
@@ -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)