From 0d179691da597b8e2cb9ff55a5875f2c60e1cfbd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Mon, 14 Sep 2015 19:27:50 +0000 Subject: [PATCH] The flag diagnostic_context::some_warnings_are_errors controls whether to give... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The flag diagnostic_context::some_warnings_are_errors controls whether to give the message "all warnings being treated as errors". However, when warnings are buffered and then discarded, this flag is not reset. It turns out we do not need this flag at all, since we already count explicitly how many warnings were converted into errors, and this number is kept up to date for the buffered diagnostics used by Fortran. gcc/ChangeLog: 2015-09-14 Manuel López-Ibáñez PR fortran/67460 * diagnostic.c (diagnostic_initialize): Do not set some_warnings_are_errors. (diagnostic_finish): Use DK_WERROR count instead. (diagnostic_report_diagnostic): Do not set some_warnings_are_errors. * diagnostic.h (struct diagnostic_context): Remove some_warnings_are_errors. gcc/testsuite/ChangeLog: 2015-09-14 Manuel López-Ibáñez PR fortran/67460 * gfortran.dg/pr67460.f90: New test. From-SVN: r227760 --- gcc/ChangeLog | 11 +++++++++++ gcc/diagnostic.c | 6 +----- gcc/diagnostic.h | 4 ---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr67460.f90 | 24 ++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr67460.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e305c1e3ed4..f731a1fd012 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-09-14 Manuel López-Ibáñez + + PR fortran/67460 + * diagnostic.c (diagnostic_initialize): Do not set + some_warnings_are_errors. + (diagnostic_finish): Use DK_WERROR count instead. + (diagnostic_report_diagnostic): Do not set + some_warnings_are_errors. + * diagnostic.h (struct diagnostic_context): Remove + some_warnings_are_errors. + 2015-09-14 Richard Sandiford * config/sparc/predicates.md (const_all_ones_operand): Use diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 01a8e35d73b..e5c3c1dbfec 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -137,7 +137,6 @@ diagnostic_initialize (diagnostic_context *context, int n_opts) new (context->printer) pretty_printer (); memset (context->diagnostic_count, 0, sizeof context->diagnostic_count); - context->some_warnings_are_errors = false; context->warning_as_error_requested = false; context->n_opts = n_opts; context->classify_diagnostic = XNEWVEC (diagnostic_t, n_opts); @@ -204,7 +203,7 @@ void diagnostic_finish (diagnostic_context *context) { /* Some of the errors may actually have been warnings. */ - if (context->some_warnings_are_errors) + if (diagnostic_kind_count (context, DK_WERROR)) { /* -Werror was given. */ if (context->warning_as_error_requested) @@ -861,9 +860,6 @@ diagnostic_report_diagnostic (diagnostic_context *context, return false; } - if (orig_diag_kind == DK_WARNING && diagnostic->kind == DK_ERROR) - context->some_warnings_are_errors = true; - context->lock++; if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 1b9b7d42865..7fcb6a8cd0e 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -66,10 +66,6 @@ struct diagnostic_context /* The number of times we have issued diagnostics. */ int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]; - /* True if we should display the "warnings are being tread as error" - message, usually displayed once per compiler run. */ - bool some_warnings_are_errors; - /* True if it has been requested that warnings be treated as errors. */ bool warning_as_error_requested; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c0354c3315..69722d073be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-14 Manuel López-Ibáñez + + PR fortran/67460 + * gfortran.dg/pr67460.f90: New test. + 2015-09-14 Uros Bizjak * gcc.dg/gomp/dump-new-function-3.c (dg-final): Also scan for $loopfn. diff --git a/gcc/testsuite/gfortran.dg/pr67460.f90 b/gcc/testsuite/gfortran.dg/pr67460.f90 new file mode 100644 index 00000000000..ede55e1229b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67460.f90 @@ -0,0 +1,24 @@ +! Bogus "all warnings being treated as errors" +! { dg-do compile } +! { dg-options "-std=f2003 -Werror" } +MODULE btree_i8_k_sp2d_v + TYPE btree_node + INTEGER id + TYPE(btree_node_p), DIMENSION(:), POINTER :: subtrees + TYPE(btree_node), POINTER :: parent + END TYPE btree_node + TYPE btree_node_p + TYPE(btree_node), POINTER :: node + END TYPE btree_node_p +CONTAINS + RECURSIVE SUBROUTINE btree_verify_node (tree, node, level, nids, lastv,& + count, num_nodes, max_leaf_level, min_leaf_level, printing) + TYPE(btree_node), INTENT(IN) :: node + INTEGER :: branch + IF (ASSOCIATED (node%subtrees(branch)%node)) THEN + IF (node%subtrees(branch)%node%parent%id .NE. node%id) THEN + WRITE(*,*)'foo' + ENDIF + ENDIF + END SUBROUTINE btree_verify_node +END MODULE btree_i8_k_sp2d_v -- 2.30.2