aboutsummaryrefslogtreecommitdiff
path: root/gcc/cccp.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>1999-12-14 08:05:23 -0800
committerRichard Henderson <rth@gcc.gnu.org>1999-12-14 08:05:23 -0800
commit223dca6a2053c626e10ac253bd02d67268a4049b (patch)
tree94fb7f433efa5a20773aff67980a0d17cc9938cc /gcc/cccp.c
parent9e3fc4303ea57e3547a1c938d1897279859ef412 (diff)
downloadgcc-223dca6a2053c626e10ac253bd02d67268a4049b.zip
gcc-223dca6a2053c626e10ac253bd02d67268a4049b.tar.gz
gcc-223dca6a2053c626e10ac253bd02d67268a4049b.tar.bz2
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
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r--gcc/cccp.c42
1 files changed, 34 insertions, 8 deletions
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':