From 3c6a9715a98d0ee9da8bf24324d0a8a4bba990f0 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Wed, 26 May 2010 13:40:53 +0000 Subject: * diagnostic.c: Don't include opts.h. (permissive_error_option): Define. (diagnostic_initialize): Take n_opts parameter. Allocate memory for classify_diagnostic. Don't use memset for classify_diagnostic. Initialize new and recently added fields. (diagnostic_classify_diagnostic): Use context->n_opts instead of N_OPTS. (diagnostic_report_diagnostic): Pass context parameter to diagnostic_report_warnings_p. Use option_enabled and option_name hooks from context. (emit_diagnostic): Use permissive_error_option. (permerror): Likewise. * diagnostic.h: Don't include options.h. (struct diagnostic_context): Add n_opts, opt_permissive, inhibit_warnings, warn_system_headers, option_enabled and option_name fields. Change classify_diagnostic to a pointer. * opts-diagnostic.h: New file. * opts.c: Include opts-diagnostic.h. (common_handle_option): Set global_dc fields for -Wfatal-errors, -Wsystem-headers, -fshow-column, -pedantic-errors and -w. (option_name): New function. * c-opts.c (c_common_init_options): Set global_dc->opt_permissive. (c_common_handle_option): Set global_dc->permissive for -fpermissive. * c-common.c (c_cpp_error): Save and restore global_dc->warn_system_headers, not variable warn_system_headers. * toplev.c: Include opts-diagnostic.h. (general_init): Update call to diagnostic_initialize. Set global_dc->show_column, global_dc->option_enabled and global_dc->option_name. (process_options): Don't set global_dc fields here. * Makefile.in (DIAGNOSTIC_H): Remove options.h. (diagnostic.o, opts.o, toplev.o): Update dependencies. fortran: * cpp.c (cb_cpp_error): Save and restore global_dc->warn_system_headers, not variable warn_system_headers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159869 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/cpp.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index be0f29f8a12..1566d08f9b6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2010-05-26 Joseph Myers + + * cpp.c (cb_cpp_error): Save and restore + global_dc->warn_system_headers, not variable warn_system_headers. + 2010-05-26 Steven Bosscher * fortran/f95-lang.c: Do not include libfuncs.h, expr.h, and except.h. diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c index 6ff464a8cf0..6361085372e 100644 --- a/gcc/fortran/cpp.c +++ b/gcc/fortran/cpp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -975,13 +975,13 @@ cb_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, { diagnostic_info diagnostic; diagnostic_t dlevel; - int save_warn_system_headers = warn_system_headers; + bool save_warn_system_headers = global_dc->warn_system_headers; bool ret; switch (level) { case CPP_DL_WARNING_SYSHDR: - warn_system_headers = 1; + global_dc->warn_system_headers = 1; /* Fall through. */ case CPP_DL_WARNING: dlevel = DK_WARNING; @@ -1012,7 +1012,7 @@ cb_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, diagnostic_override_option_index (&diagnostic, OPT_Wcpp); ret = report_diagnostic (&diagnostic); if (level == CPP_DL_WARNING_SYSHDR) - warn_system_headers = save_warn_system_headers; + global_dc->warn_system_headers = save_warn_system_headers; return ret; } -- cgit v1.2.1