]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.h
Added -Wunknown-pragmas
[xonotic/gmqcc.git] / ast.h
diff --git a/ast.h b/ast.h
index 29c3192df4acd1c1ecfbbeb18870481c0d36e66c..25243c069c0f4ba3d6d65464fae87782581b4385 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -52,27 +52,27 @@ typedef struct ast_label_s       ast_label;
 typedef struct ast_goto_s        ast_goto;
 
 enum {
-    TYPE_ast_node,
-    TYPE_ast_expression,
-    TYPE_ast_value,
-    TYPE_ast_function,
-    TYPE_ast_block,
-    TYPE_ast_binary,
-    TYPE_ast_store,
-    TYPE_ast_binstore,
-    TYPE_ast_entfield,
-    TYPE_ast_ifthen,
-    TYPE_ast_ternary,
-    TYPE_ast_loop,
-    TYPE_ast_call,
-    TYPE_ast_unary,
-    TYPE_ast_return,
-    TYPE_ast_member,
-    TYPE_ast_array_index,
-    TYPE_ast_breakcont,
-    TYPE_ast_switch,
-    TYPE_ast_label,
-    TYPE_ast_goto
+    TYPE_ast_node,        /*  0 */
+    TYPE_ast_expression,  /*  1 */
+    TYPE_ast_value,       /*  2 */
+    TYPE_ast_function,    /*  3 */
+    TYPE_ast_block,       /*  4 */
+    TYPE_ast_binary,      /*  5 */
+    TYPE_ast_store,       /*  6 */
+    TYPE_ast_binstore,    /*  7 */
+    TYPE_ast_entfield,    /*  8 */
+    TYPE_ast_ifthen,      /*  9 */
+    TYPE_ast_ternary,     /* 10 */
+    TYPE_ast_loop,        /* 11 */
+    TYPE_ast_call,        /* 12 */
+    TYPE_ast_unary,       /* 13 */
+    TYPE_ast_return,      /* 14 */
+    TYPE_ast_member,      /* 15 */
+    TYPE_ast_array_index, /* 16 */
+    TYPE_ast_breakcont,   /* 17 */
+    TYPE_ast_switch,      /* 18 */
+    TYPE_ast_label,       /* 19 */
+    TYPE_ast_goto         /* 20 */
 };
 
 #define ast_istype(x, t) ( ((ast_node_common*)x)->nodetype == (TYPE_##t) )
@@ -159,7 +159,8 @@ struct ast_value_s
     ast_value  *next;
     */
 
-    bool constant;
+    bool cvq;     /* const/var qualifier */
+    bool isfield; /* this declares a field */
     bool hasvalue;
     union {
         double        vfloat;
@@ -168,6 +169,7 @@ struct ast_value_s
         const char   *vstring;
         int           ventity;
         ast_function *vfunc;
+        ast_value    *vfield;
     } constval;
 
     /* usecount for the parser */
@@ -234,6 +236,8 @@ struct ast_binstore_s
     int             opbin;
     ast_expression *dest;
     ast_expression *source;
+    /* for &~= which uses the destination in a binary in source we can use this */
+    bool            keep_dest;
 };
 ast_binstore* ast_binstore_new(lex_ctx    ctx,
                                int        storeop,
@@ -569,7 +573,7 @@ bool ast_block_set_type(ast_block*, ast_expression *from);
 bool ast_block_codegen(ast_block*, ast_function*, bool lvalue, ir_value**);
 void ast_block_collect(ast_block*, ast_expression*);
 
-void ast_block_add_expr(ast_block*, ast_expression*);
+bool GMQCC_WARN ast_block_add_expr(ast_block*, ast_expression*);
 
 /* Function
  *
@@ -622,6 +626,7 @@ void ast_function_delete(ast_function*);
 const char* ast_function_label(ast_function*, const char *prefix);
 
 bool ast_function_codegen(ast_function *self, ir_builder *builder);
+bool ast_generate_accessors(ast_value *asvalue, ir_builder *ir);
 
 /* Expression union
  */