From 2f9ca7dce2adea10d7947e98690b729cce947938 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 25 Mar 2010 16:47:49 -0700 Subject: [PATCH] Fix up the operator printing for the logic or and beyond, check array bounds. --- ast_expr.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ast_expr.cpp b/ast_expr.cpp index ad29cdc..4e83dec 100644 --- a/ast_expr.cpp +++ b/ast_expr.cpp @@ -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]; } -- 2.7.4