This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to printing 'noexcept' in diagnostics


Printing "noexcept (true)" is redundant.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 5305dc0cdb0736a0c56ce3d126b4baad0521f096
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Oct 3 15:35:11 2013 -0400

    	* error.c (dump_exception_spec): Print "noexcept" rather than
    	"noexcept (true)".

diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 0c3cead..3f6f594 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1595,13 +1595,16 @@ dump_exception_spec (cxx_pretty_printer *pp, tree t, int flags)
   if (t && TREE_PURPOSE (t))
     {
       pp_cxx_ws_string (pp, "noexcept");
-      pp_cxx_whitespace (pp);
-      pp_cxx_left_paren (pp);
-      if (DEFERRED_NOEXCEPT_SPEC_P (t))
-	pp_cxx_ws_string (pp, "<uninstantiated>");
-      else
-	dump_expr (pp, TREE_PURPOSE (t), flags);
-      pp_cxx_right_paren (pp);
+      if (!integer_onep (TREE_PURPOSE (t)))
+	{
+	  pp_cxx_whitespace (pp);
+	  pp_cxx_left_paren (pp);
+	  if (DEFERRED_NOEXCEPT_SPEC_P (t))
+	    pp_cxx_ws_string (pp, "<uninstantiated>");
+	  else
+	    dump_expr (pp, TREE_PURPOSE (t), flags);
+	  pp_cxx_right_paren (pp);
+	}
     }
   else if (t)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]