Commit e05eb761 by Richard Henderson

cccp.c (main): Define __STDC_VERSION__ as necessary.

        * cccp.c (main): Define __STDC_VERSION__ as necessary.
        * cppinit.c (cpp_handle_option): Likewise.

        * ginclude/stdarg.h (va_copy): Use __STDC_VERSION__ to
        determine when to define.

From-SVN: r31022
parent 09fe1c49
Sat Dec 18 20:42:43 1999 Richard Henderson <rth@cygnus.com>
* cccp.c (main): Define __STDC_VERSION__ as necessary.
* cppinit.c (cpp_handle_option): Likewise.
* ginclude/stdarg.h (va_copy): Use __STDC_VERSION__ to
determine when to define.
Sat Dec 18 20:34:00 1999 Richard Henderson <rth@cygnus.com> Sat Dec 18 20:34:00 1999 Richard Henderson <rth@cygnus.com>
* alpha.c (alpha_emit_conditional_move): If TARGET_FIX, handle * alpha.c (alpha_emit_conditional_move): If TARGET_FIX, handle
......
...@@ -1264,7 +1264,7 @@ main (argc, argv) ...@@ -1264,7 +1264,7 @@ main (argc, argv)
progname need to be set first, in case a diagnostic is issued. */ progname need to be set first, in case a diagnostic is issued. */
pend_files = (char **) xmalloc (argc * sizeof (char *)); pend_files = (char **) xmalloc (argc * sizeof (char *));
pend_defs = (char **) xmalloc (argc * sizeof (char *)); pend_defs = (char **) xmalloc ((2 * argc) * sizeof (char *));
pend_undefs = (char **) xmalloc (argc * sizeof (char *)); pend_undefs = (char **) xmalloc (argc * sizeof (char *));
pend_assertions = (char **) xmalloc (argc * sizeof (char *)); pend_assertions = (char **) xmalloc (argc * sizeof (char *));
pend_includes = (char **) xmalloc (argc * sizeof (char *)); pend_includes = (char **) xmalloc (argc * sizeof (char *));
...@@ -1284,7 +1284,7 @@ main (argc, argv) ...@@ -1284,7 +1284,7 @@ main (argc, argv)
cplusplus_comments = 1; cplusplus_comments = 1;
bzero ((char *) pend_files, argc * sizeof (char *)); bzero ((char *) pend_files, argc * sizeof (char *));
bzero ((char *) pend_defs, argc * sizeof (char *)); bzero ((char *) pend_defs, (2 * argc) * sizeof (char *));
bzero ((char *) pend_undefs, argc * sizeof (char *)); bzero ((char *) pend_undefs, argc * sizeof (char *));
bzero ((char *) pend_assertions, argc * sizeof (char *)); bzero ((char *) pend_assertions, argc * sizeof (char *));
bzero ((char *) pend_includes, argc * sizeof (char *)); bzero ((char *) pend_includes, argc * sizeof (char *));
...@@ -1457,7 +1457,7 @@ main (argc, argv) ...@@ -1457,7 +1457,7 @@ main (argc, argv)
{ {
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; no_trigraphs = 0;
pend_defs[i] = "__STRICT_ANSI__=199000"; pend_defs[2*i] = "__STRICT_ANSI__";
} }
else if (! strcmp (argv[i], "-lang-c++")) else if (! strcmp (argv[i], "-lang-c++"))
cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0; cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0;
...@@ -1484,19 +1484,21 @@ main (argc, argv) ...@@ -1484,19 +1484,21 @@ main (argc, argv)
|| !strcmp (argv[i], "-std=gnu99")) || !strcmp (argv[i], "-std=gnu99"))
{ {
cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0;
pend_defs[2*i+1] = "__STDC_VERSION__=199901L";
} }
else if (!strcmp (argv[i], "-std=iso9899:1990") else if (!strcmp (argv[i], "-std=iso9899:1990")
|| !strcmp (argv[i], "-std=c89")) || !strcmp (argv[i], "-std=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; no_trigraphs = 0;
pend_defs[i] = "__STRICT_ANSI__=199000"; pend_defs[2*i] = "__STRICT_ANSI__";
} }
else if (!strcmp (argv[i], "-std=iso9899:199409")) else if (!strcmp (argv[i], "-std=iso9899:199409"))
{ {
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; no_trigraphs = 0;
pend_defs[i] = "__STRICT_ANSI__=199409"; pend_defs[2*i] = "__STRICT_ANSI__";
pend_defs[2*i+1] = "__STDC_VERSION__=199409L";
} }
else if (!strcmp (argv[i], "-std=iso9899:199x") else if (!strcmp (argv[i], "-std=iso9899:199x")
|| !strcmp (argv[i], "-std=iso9899:1999") || !strcmp (argv[i], "-std=iso9899:1999")
...@@ -1505,7 +1507,8 @@ main (argc, argv) ...@@ -1505,7 +1507,8 @@ main (argc, argv)
{ {
cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0;
no_trigraphs = 0; no_trigraphs = 0;
pend_defs[i] = "__STRICT_ANSI__=199900"; pend_defs[2*i] = "__STRICT_ANSI__";
pend_defs[2*i+1] = "__STDC_VERSION__=199901L";
} }
break; break;
...@@ -1655,11 +1658,11 @@ main (argc, argv) ...@@ -1655,11 +1658,11 @@ main (argc, argv)
case 'D': case 'D':
if (argv[i][2] != 0) if (argv[i][2] != 0)
pend_defs[i] = argv[i] + 2; pend_defs[2*i] = argv[i] + 2;
else if (i + 1 == argc) else if (i + 1 == argc)
fatal ("Macro name missing after -D option"); fatal ("Macro name missing after -D option");
else else
i++, pend_defs[i] = argv[i]; i++, pend_defs[2*i] = argv[i];
break; break;
case 'A': case 'A':
...@@ -1680,7 +1683,7 @@ main (argc, argv) ...@@ -1680,7 +1683,7 @@ main (argc, argv)
that were passed automatically in from GCC. */ that were passed automatically in from GCC. */
int j; int j;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
pend_defs[j] = pend_assertions[j] = 0; pend_defs[2*j] = pend_assertions[j] = 0;
} else { } else {
pend_assertions[i] = p; pend_assertions[i] = p;
pend_assertion_options[i] = "-A"; pend_assertion_options[i] = "-A";
...@@ -1805,10 +1808,15 @@ main (argc, argv) ...@@ -1805,10 +1808,15 @@ main (argc, argv)
output_line_directive (fp, &outbuf, 0, same_file); output_line_directive (fp, &outbuf, 0, same_file);
make_undef (pend_undefs[i], &outbuf); make_undef (pend_undefs[i], &outbuf);
} }
if (pend_defs[i]) { if (pend_defs[2*i]) {
if (debug_output) if (debug_output)
output_line_directive (fp, &outbuf, 0, same_file); output_line_directive (fp, &outbuf, 0, same_file);
make_definition (pend_defs[i]); make_definition (pend_defs[2*i]);
}
if (pend_defs[2*i+1]) {
if (debug_output)
output_line_directive (fp, &outbuf, 0, same_file);
make_definition (pend_defs[2*i+1]);
} }
if (pend_assertions[i]) if (pend_assertions[i])
make_assertion (pend_assertion_options[i], pend_assertions[i]); make_assertion (pend_assertion_options[i], pend_assertions[i]);
......
...@@ -1331,7 +1331,7 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1331,7 +1331,7 @@ cpp_handle_option (pfile, argc, argv)
opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->cplusplus = 0, opts->cplusplus_comments = 0;
opts->c89 = 1, opts->c9x = 0, opts->objc = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0;
opts->trigraphs = 1; opts->trigraphs = 1;
new_pending_define (opts, "__STRICT_ANSI__=199000"); new_pending_define (opts, "__STRICT_ANSI__");
} }
if (! strcmp (argv[i], "-lang-c++")) if (! strcmp (argv[i], "-lang-c++"))
opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0, opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0,
...@@ -1365,6 +1365,7 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1365,6 +1365,7 @@ cpp_handle_option (pfile, argc, argv)
{ {
opts->cplusplus = 0, opts->cplusplus_comments = 1; opts->cplusplus = 0, opts->cplusplus_comments = 1;
opts->c89 = 0, opts->c9x = 1, opts->objc = 0; opts->c89 = 0, opts->c9x = 1, opts->objc = 0;
new_pending_define (opts, "__STDC_VERSION__=199901L");
} }
else if (!strcmp (argv[i], "-std=iso9899:1990") else if (!strcmp (argv[i], "-std=iso9899:1990")
|| !strcmp (argv[i], "-std=c89")) || !strcmp (argv[i], "-std=c89"))
...@@ -1372,14 +1373,15 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1372,14 +1373,15 @@ cpp_handle_option (pfile, argc, argv)
opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->cplusplus = 0, opts->cplusplus_comments = 0;
opts->c89 = 1, opts->c9x = 0, opts->objc = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0;
opts->trigraphs = 1; opts->trigraphs = 1;
new_pending_define (opts, "__STRICT_ANSI__=199000"); new_pending_define (opts, "__STRICT_ANSI__");
} }
else if (!strcmp (argv[i], "-std=iso9899:199409")) else if (!strcmp (argv[i], "-std=iso9899:199409"))
{ {
opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->cplusplus = 0, opts->cplusplus_comments = 0;
opts->c89 = 1, opts->c9x = 0, opts->objc = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0;
opts->trigraphs = 1; opts->trigraphs = 1;
new_pending_define (opts, "__STRICT_ANSI__=199409"); new_pending_define (opts, "__STRICT_ANSI__");
new_pending_define (opts, "__STDC_VERSION__=199409L");
} }
else if (!strcmp (argv[i], "-std=iso9899:199x") else if (!strcmp (argv[i], "-std=iso9899:199x")
|| !strcmp (argv[i], "-std=iso9899:1999") || !strcmp (argv[i], "-std=iso9899:1999")
...@@ -1389,7 +1391,8 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1389,7 +1391,8 @@ cpp_handle_option (pfile, argc, argv)
opts->cplusplus = 0, opts->cplusplus_comments = 1; opts->cplusplus = 0, opts->cplusplus_comments = 1;
opts->c89 = 0, opts->c9x = 1, opts->objc = 0; opts->c89 = 0, opts->c9x = 1, opts->objc = 0;
opts->trigraphs = 1; opts->trigraphs = 1;
new_pending_define (opts, "__STRICT_ANSI__=199900"); new_pending_define (opts, "__STRICT_ANSI__");
new_pending_define (opts, "__STDC_VERSION__=199901L");
} }
break; break;
......
...@@ -54,7 +54,7 @@ typedef __builtin_va_list __gnuc_va_list; ...@@ -54,7 +54,7 @@ typedef __builtin_va_list __gnuc_va_list;
#define va_start(v,l) __builtin_stdarg_start(&(v),l) #define va_start(v,l) __builtin_stdarg_start(&(v),l)
#define va_end __builtin_va_end #define va_end __builtin_va_end
#define va_arg __builtin_va_arg #define va_arg __builtin_va_arg
#if defined(__STRICT_ANSI__) && __STRICT_ANSI__ + 0 < 199900 #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
#define va_copy(d,s) __builtin_va_copy(&(d),(s)) #define va_copy(d,s) __builtin_va_copy(&(d),(s))
#endif #endif
#define __va_copy(d,s) __builtin_va_copy(&(d),(s)) #define __va_copy(d,s) __builtin_va_copy(&(d),(s))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment