OSDN Git Service

Fix up the operator printing for the logic or and beyond, check array bounds.
authorEric Anholt <eric@anholt.net>
Thu, 25 Mar 2010 23:47:49 +0000 (16:47 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 25 Mar 2010 23:47:49 +0000 (16:47 -0700)
ast_expr.cpp

index ad29cdc..4e83dec 100644 (file)
@@ -50,6 +50,7 @@ ast_expression::operator_string(enum ast_operators op)
       "~",
       "&&",
       "^^",
+      "||",
       "!",
 
       "*=",
@@ -64,6 +65,7 @@ ast_expression::operator_string(enum ast_operators op)
       "|=",
 
       "?:",
+
       "++",
       "--",
       "++",
@@ -71,6 +73,8 @@ ast_expression::operator_string(enum ast_operators op)
       ".",
    };
 
+   assert((unsigned int)op < sizeof(operators) / sizeof(operators[0]));
+
    return operators[op];
 }