From 223dca6a2053c626e10ac253bd02d67268a4049b Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 14 Dec 1999 08:05:23 -0800 Subject: cppp.c (main): Set trigraphs and __STRICT_ANSI__ as appropriate for -lang-c89 and -std=*. * cppp.c (main): Set trigraphs and __STRICT_ANSI__ as appropriate for -lang-c89 and -std=*. * cppinit.c (cpp_handle_option): Likewise. (new_pending_define): New, split out from cpp_handle_option. * gcc.c (default_compilers): Don't define __STRICT_ANSI__ or enable trigraphs for -ansi/-std=*. * ginclude/stdarg.h (__va_copy): New. (va_copy): Don't define for C89. From-SVN: r30921 --- gcc/cccp.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'gcc/cccp.c') diff --git a/gcc/cccp.c b/gcc/cccp.c index a21daf1..4acc214 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -1454,7 +1454,11 @@ main (argc, argv) if (! strcmp (argv[i], "-lang-c")) cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; else if (! strcmp (argv[i], "-lang-c89")) - cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + { + cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + no_trigraphs = 0; + pend_defs[i] = "__STRICT_ANSI__=199000"; + } else if (! strcmp (argv[i], "-lang-c++")) cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0; else if (! strcmp (argv[i], "-lang-objc")) @@ -1472,15 +1476,37 @@ main (argc, argv) break; case 's': - if (!strcmp (argv[i], "-std=iso9899:1990") - || !strcmp (argv[i], "-std=iso9899:199409") - || !strcmp (argv[i], "-std=c89") - || !strcmp (argv[i], "-std=gnu89")) - cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + if (!strcmp (argv[i], "-std=gnu89")) + { + cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + } + else if (!strcmp (argv[i], "-std=gnu9x") + || !strcmp (argv[i], "-std=gnu99")) + { + cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; + } + else if (!strcmp (argv[i], "-std=iso9899:1990") + || !strcmp (argv[i], "-std=c89")) + { + cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + no_trigraphs = 0; + pend_defs[i] = "__STRICT_ANSI__=199000"; + } + else if (!strcmp (argv[i], "-std=iso9899:199409")) + { + cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; + no_trigraphs = 0; + pend_defs[i] = "__STRICT_ANSI__=199409"; + } else if (!strcmp (argv[i], "-std=iso9899:199x") + || !strcmp (argv[i], "-std=iso9899:1999") || !strcmp (argv[i], "-std=c9x") - || !strcmp (argv[i], "-std=gnu9x")) - cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; + || !strcmp (argv[i], "-std=c99")) + { + cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; + no_trigraphs = 0; + pend_defs[i] = "__STRICT_ANSI__=199900"; + } break; case 'w': -- cgit v1.1