diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc6058ad163..54eead1f94e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Sat Dec 18 20:42:43 1999 Richard Henderson + + * 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 * alpha.c (alpha_emit_conditional_move): If TARGET_FIX, handle @@ -49,27 +57,27 @@ Sat Dec 18 05:29:29 1999 Scott Bambrough 1999-12-18 Gabriel Dos Reis - * toplev.c (notice, vmessage, v_message_with_file_and_line, - v_message_with_decl, file_and_line_for_asm, - v_error_with_file_and_line, v_error_with_decl, v_error_for_asm, - verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl, - v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl, - v_pedwarn_with_file_and_line, vsorry, vnotice, count_error, - pfatal_with_name, fatal_io_error, need_error_newline, - last_error_function, last_error_tick, announce_function, - default_print_error_function, print_error_function, - report_error_function, fnotice, error_with_file_and_line, - error_with_decl, error_for_asm, error, set_fatal_function, fatal, - _fatal_insn, _fatal_insn_not_found, warning_with_file_and_line, - warning_with_decl, warning_for_asm, warning, pedwarn, - pedwarn_with_decl, pedwarn_with_file_and_line, sorry): Move to - diagnostic.c - (compile_file): Use fnotice instead of notice. Adjust call. + * toplev.c (notice, vmessage, v_message_with_file_and_line, + v_message_with_decl, file_and_line_for_asm, + v_error_with_file_and_line, v_error_with_decl, v_error_for_asm, + verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl, + v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl, + v_pedwarn_with_file_and_line, vsorry, vnotice, count_error, + pfatal_with_name, fatal_io_error, need_error_newline, + last_error_function, last_error_tick, announce_function, + default_print_error_function, print_error_function, + report_error_function, fnotice, error_with_file_and_line, + error_with_decl, error_for_asm, error, set_fatal_function, fatal, + _fatal_insn, _fatal_insn_not_found, warning_with_file_and_line, + warning_with_decl, warning_for_asm, warning, pedwarn, + pedwarn_with_decl, pedwarn_with_file_and_line, sorry): Move to + diagnostic.c + (compile_file): Use fnotice instead of notice. Adjust call. - * diagnostic.c: New file. + * diagnostic.c: New file. - * Makefile.in (OBJS): Include diagnostic.o - (diagnostic.o): Define dependence. + * Makefile.in (OBJS): Include diagnostic.o + (diagnostic.o): Define dependence. 1999-12-18 Michael Hayes diff --git a/gcc/cccp.c b/gcc/cccp.c index 4acc21470c4..01f93d60254 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -1264,7 +1264,7 @@ main (argc, argv) progname need to be set first, in case a diagnostic is issued. */ 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_assertions = (char **) xmalloc (argc * sizeof (char *)); pend_includes = (char **) xmalloc (argc * sizeof (char *)); @@ -1284,7 +1284,7 @@ main (argc, argv) cplusplus_comments = 1; 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_assertions, argc * sizeof (char *)); bzero ((char *) pend_includes, argc * sizeof (char *)); @@ -1457,7 +1457,7 @@ main (argc, argv) { cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; no_trigraphs = 0; - pend_defs[i] = "__STRICT_ANSI__=199000"; + pend_defs[2*i] = "__STRICT_ANSI__"; } else if (! strcmp (argv[i], "-lang-c++")) cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0; @@ -1484,19 +1484,21 @@ main (argc, argv) || !strcmp (argv[i], "-std=gnu99")) { 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") || !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"; + pend_defs[2*i] = "__STRICT_ANSI__"; } 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"; + pend_defs[2*i] = "__STRICT_ANSI__"; + pend_defs[2*i+1] = "__STDC_VERSION__=199409L"; } else if (!strcmp (argv[i], "-std=iso9899:199x") || !strcmp (argv[i], "-std=iso9899:1999") @@ -1505,7 +1507,8 @@ main (argc, argv) { cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 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; @@ -1655,11 +1658,11 @@ main (argc, argv) case 'D': if (argv[i][2] != 0) - pend_defs[i] = argv[i] + 2; + pend_defs[2*i] = argv[i] + 2; else if (i + 1 == argc) fatal ("Macro name missing after -D option"); else - i++, pend_defs[i] = argv[i]; + i++, pend_defs[2*i] = argv[i]; break; case 'A': @@ -1680,7 +1683,7 @@ main (argc, argv) that were passed automatically in from GCC. */ int j; for (j = 0; j < i; j++) - pend_defs[j] = pend_assertions[j] = 0; + pend_defs[2*j] = pend_assertions[j] = 0; } else { pend_assertions[i] = p; pend_assertion_options[i] = "-A"; @@ -1805,10 +1808,15 @@ main (argc, argv) output_line_directive (fp, &outbuf, 0, same_file); make_undef (pend_undefs[i], &outbuf); } - if (pend_defs[i]) { + if (pend_defs[2*i]) { if (debug_output) 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]) make_assertion (pend_assertion_options[i], pend_assertions[i]); diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 3ffda8a337c..2bec8450901 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -1331,7 +1331,7 @@ cpp_handle_option (pfile, argc, argv) opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0; opts->trigraphs = 1; - new_pending_define (opts, "__STRICT_ANSI__=199000"); + new_pending_define (opts, "__STRICT_ANSI__"); } if (! strcmp (argv[i], "-lang-c++")) opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0, @@ -1365,6 +1365,7 @@ cpp_handle_option (pfile, argc, argv) { opts->cplusplus = 0, opts->cplusplus_comments = 1; opts->c89 = 0, opts->c9x = 1, opts->objc = 0; + new_pending_define (opts, "__STDC_VERSION__=199901L"); } else if (!strcmp (argv[i], "-std=iso9899:1990") || !strcmp (argv[i], "-std=c89")) @@ -1372,14 +1373,15 @@ cpp_handle_option (pfile, argc, argv) opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0; opts->trigraphs = 1; - new_pending_define (opts, "__STRICT_ANSI__=199000"); + new_pending_define (opts, "__STRICT_ANSI__"); } else if (!strcmp (argv[i], "-std=iso9899:199409")) { opts->cplusplus = 0, opts->cplusplus_comments = 0; opts->c89 = 1, opts->c9x = 0, opts->objc = 0; 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") || !strcmp (argv[i], "-std=iso9899:1999") @@ -1389,7 +1391,8 @@ cpp_handle_option (pfile, argc, argv) opts->cplusplus = 0, opts->cplusplus_comments = 1; opts->c89 = 0, opts->c9x = 1, opts->objc = 0; opts->trigraphs = 1; - new_pending_define (opts, "__STRICT_ANSI__=199900"); + new_pending_define (opts, "__STRICT_ANSI__"); + new_pending_define (opts, "__STDC_VERSION__=199901L"); } break; diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h index c74c80d392b..2464599c1b5 100644 --- a/gcc/ginclude/stdarg.h +++ b/gcc/ginclude/stdarg.h @@ -54,7 +54,7 @@ typedef __builtin_va_list __gnuc_va_list; #define va_start(v,l) __builtin_stdarg_start(&(v),l) #define va_end __builtin_va_end #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)) #endif #define __va_copy(d,s) __builtin_va_copy(&(d),(s))