From f7ab8af90861a57049c0b6d93d6ca1f36dc332e9 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 18 Mar 2008 12:42:37 +0000 Subject: [PATCH] add option -std=, supporting c99, c89, gnu99, microsoft [r18975] --- TODO | 2 +- main.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 9a85373..54d9759 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,9 @@ Driver: -- add an -std= option (for c99, gnu99, ms at least) Refactoring: - eliminate target_architecture.h and replace with stuff in lang_features.h - redo storage classes: so we can separate real from declared storage class +- create structures for variables and functions, removing the omnipotent declaration Lexer: - Add preprocessor code diff --git a/main.c b/main.c index a0f17a5..b5f1a1d 100644 --- a/main.c +++ b/main.c @@ -524,7 +524,16 @@ int main(int argc, char **argv) } else if(strcmp(option, "pedantic") == 0) { fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg); } else if(strncmp(option, "std=", 4) == 0) { - fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg); + if(strcmp(&option[4], "c99") == 0) { + c_mode = _C89|_C99; + } else if(strcmp(&option[4], "c89") == 0) { + c_mode = _C89; + } else if(strcmp(&option[4], "gnu99") == 0) { + c_mode = _C89|_C99|_GNUC; + } else if(strcmp(&option[4], "microsoft") == 0) { + c_mode = _C89|_C99|_MS; + } else + fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg); } else if (option[0] == '-') { /* double dash option */ ++option; -- 2.20.1