add option -std=, supporting c99, c89, gnu99, microsoft
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 18 Mar 2008 12:42:37 +0000 (12:42 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 18 Mar 2008 12:42:37 +0000 (12:42 +0000)
[r18975]

TODO
main.c

diff --git a/TODO b/TODO
index 9a85373..54d9759 100644 (file)
--- 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 (file)
--- 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;