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 ad29cdc68d73b9b6ed138b0981a31b1621a4e7bd..4e83decb924d95e775b5004c7227ffbf5865b033 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];
 }