enum entries are constant, transform -fomit-frame-pointer to -bomitfp
authorMatthias Braun <matze@braunis.de>
Wed, 5 Dec 2007 16:30:24 +0000 (16:30 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 5 Dec 2007 16:30:24 +0000 (16:30 +0000)
[r18611]

ast.c
main.c

diff --git a/ast.c b/ast.c
index d25a63e..08499d7 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -762,7 +762,6 @@ bool is_constant_expression(const expression_t *expression)
 
        case EXPR_BUILTIN_SYMBOL:
        case EXPR_CALL:
-       case EXPR_REFERENCE:
        case EXPR_SELECT:
        case EXPR_VA_START:
        case EXPR_VA_ARG:
@@ -834,6 +833,14 @@ bool is_constant_expression(const expression_t *expression)
                return is_constant_expression(expression->array_access.array_ref)
                        && is_constant_expression(expression->array_access.index);
 
+       case EXPR_REFERENCE: {
+               declaration_t *declaration = expression->reference.declaration;
+               if(declaration->storage_class == STORAGE_CLASS_ENUM_ENTRY)
+                       return true;
+
+               return false;
+       }
+
        case EXPR_UNKNOWN:
        case EXPR_INVALID:
                break;
diff --git a/main.c b/main.c
index 49446f0..ce8c6ff 100644 (file)
--- a/main.c
+++ b/main.c
@@ -413,13 +413,21 @@ int main(int argc, char **argv)
                } else if(arg[0] == '-' && arg[1] == 'f') {
                        const char *opt;
                        GET_ARG_AFTER(opt, "-f");
-                       int res = firm_option(opt);
-                       if (res == 0) {
-                               fprintf(stderr, "error: unknown Firm option '-f %s'\n", opt);
-                               argument_errors = true;
-                               continue;
-                       } else if (res == -1) {
-                               help_displayed = true;
+
+                       if(strcmp(opt, "omit-frame-pointer") == 0) {
+                               firm_be_option("omitfp");
+                       } else if(strcmp(opt, "no-omit-frame-pointer") == 0) {
+                               firm_be_option("omitfp=no");
+                       } else {
+                               int res = firm_option(opt);
+                               if (res == 0) {
+                                       fprintf(stderr, "error: unknown Firm option '-f %s'\n",
+                                               opt);
+                                       argument_errors = true;
+                                       continue;
+                               } else if (res == -1) {
+                                       help_displayed = true;
+                               }
                        }
                } else if(arg[0] == '-' && arg[1] == 'b') {
                        const char *opt;
@@ -444,8 +452,9 @@ int main(int argc, char **argv)
                        if (value != 16 && value != 32 && value != 64) {
                                fprintf(stderr, "error: option -m supports only 16, 32 or 64\n");
                                argument_errors = true;
-                       } else
+                       } else {
                                machine_size = (unsigned int)value;
+                       }
                } else if(arg[0] == '-') {
                        if (arg[1] == '\0') {
                                if(input != NULL) {
@@ -457,7 +466,6 @@ int main(int argc, char **argv)
                        } else if(strcmp(arg, "-pedantic") == 0) {
                                fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg);
                        } else if(arg[1] == 'O' ||
-                                       arg[1] == 'f' ||
                                        arg[1] == 'W' ||
                                        arg[1] == 'g' ||
                                        strncmp(arg + 1, "std=", 4) == 0) {