]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
Fix ~ unary operator (can now const-fold). Also things like b &= ~1 work now. We...
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index fed9b31f422d1452454ec8104606432bd5117b64..51c2dccbdc1dc41a8e7d5b4916292d79f7dc14f5 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -102,8 +102,10 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
  */
 #if defined(__GNUC__) || defined(__CLANG__)
 #   define GMQCC_WARN __attribute__((warn_unused_result))
+#   define GMQCC_USED __attribute__((used))
 #else
 #   define GMQCC_WARN
+#   define GMQCC_USED
 #endif
 /*
  * This is a hack to silent clang regarding empty
@@ -451,7 +453,8 @@ GMQCC_INLINE FILE   *file_open   (const char *, const char *);
 /*=========================== correct.c =============================*/
 /*===================================================================*/
 typedef struct {
-    char ***edits;
+    char   ***edits;
+    size_t  **lens;
 } correction_t;
 
 void  correct_del (correct_trie_t*, size_t **);
@@ -681,17 +684,11 @@ enum {
     INSTR_BITAND,
     INSTR_BITOR,
 
-    /*
-     * Virtual instructions used by the assembler
-     * keep at the end but before virtual instructions
-     * for the IR below.
-     */
-    AINSTR_END,
-
     /*
      * Virtual instructions used by the IR
      * Keep at the end!
      */
+    VINSTR_END,
     VINSTR_PHI,
     VINSTR_JUMP,
     VINSTR_COND,
@@ -1131,7 +1128,9 @@ enum {
 #   include "opts.def"
     OPTION_COUNT
 };
-static const char *opts_options_descriptions[OPTION_COUNT + 1] = {
+
+
+GMQCC_USED static const char *opts_options_descriptions[] = {
 #   define GMQCC_TYPE_OPTIONS
 #   define GMQCC_DEFINE_FLAG(X, Y) Y,
 #   include "opts.def"
@@ -1148,13 +1147,6 @@ typedef enum {
     COMPILER_GMQCC    /* this   QuakeC */
 } opts_std_t;
 
-typedef enum {
-    OPT_TYPE_BOOL,
-    OPT_TYPE_U16,
-    OPT_TYPE_U32,
-    OPT_TYPE_STR
-} opt_type_t;
-
 typedef union {
     bool     B;
     uint16_t U16;
@@ -1163,10 +1155,6 @@ typedef union {
 } opt_value_t;
 
 
-#define OPTION_VALUE_BOOL(X) (opts.options[X].B)
-#define OPTION_VALUE_U16(X)  (opts.options[X].U16)
-#define OPTION_VALUE_U32(X)  (opts.options[X].U32)
-#define OPTION_VALUE_STR(X)  (opts.options[X].STR)
 typedef struct {
     opt_value_t  options      [OPTION_COUNT];
     uint32_t     flags        [1 + (COUNT_FLAGS         / 32)];
@@ -1184,5 +1172,9 @@ extern opts_cmd_t opts;
 #define OPTS_WARN(i)         OPTS_GENERIC(opts.warn,         (i))
 #define OPTS_WERROR(i)       OPTS_GENERIC(opts.werror,       (i))
 #define OPTS_OPTIMIZATION(i) OPTS_GENERIC(opts.optimization, (i))
+#define OPTS_OPTION_BOOL(X) (opts.options[X].B)
+#define OPTS_OPTION_U16(X)  (opts.options[X].U16)
+#define OPTS_OPTION_U32(X)  (opts.options[X].U32)
+#define OPTS_OPTION_STR(X)  (opts.options[X].STR)
 
 #endif