public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@acm.org>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] small gcc.c cleanup
Date: Mon, 28 Aug 2017 15:34:00 -0000	[thread overview]
Message-ID: <fedd15b1-7313-3d84-b913-83679e5717be@acm.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

I committed this update to my post of 
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01011.html, deciding it 
now sufficiently obvious :)

nathan
-- 
Nathan Sidwell

[-- Attachment #2: gcc-switch.diff --]
[-- Type: text/x-patch, Size: 3119 bytes --]

2017-08-28  Nathan Sidwell  <nathan@acm.org>

	* gcc.c (execute): Fold SIGPIPE handling into switch
	statement.  Adjust internal error message.

Index: gcc.c
===================================================================
--- gcc.c	(revision 251380)
+++ gcc.c	(working copy)
@@ -3135,49 +3135,50 @@ execute (void)
 	int status = statuses[i];
 
 	if (WIFSIGNALED (status))
-	  {
-#ifdef SIGPIPE
-	    /* SIGPIPE is a special case.  It happens in -pipe mode
-	       when the compiler dies before the preprocessor is done,
-	       or the assembler dies before the compiler is done.
-	       There's generally been an error already, and this is
-	       just fallout.  So don't generate another error unless
-	       we would otherwise have succeeded.  */
-	    if (WTERMSIG (status) == SIGPIPE
-		&& (signal_count || greatest_status >= MIN_FATAL_STATUS))
-	      {
-		signal_count++;
-		ret_code = -1;
-	      }
-	    else
-#endif
-	      switch (WTERMSIG (status))
-		{
-		case SIGINT:
-		/* SIGQUIT and SIGKILL are not available on MinGW.  */
+	  switch (WTERMSIG (status))
+	    {
+	    case SIGINT:
+	    case SIGTERM:
+	      /* SIGQUIT and SIGKILL are not available on MinGW.  */
 #ifdef SIGQUIT
-		case SIGQUIT:
+	    case SIGQUIT:
 #endif
 #ifdef SIGKILL
-		case SIGKILL:
+	    case SIGKILL:
 #endif
-		case SIGTERM:
-		  /* The user (or environment) did something to the
-		     inferior.  Making this an ICE confuses the user
-		     into thinking there's a compiler bug.  Much more
-		     likely is the user or OOM killer nuked it.  */
-		  fatal_error (input_location,
-			       "%s signal terminated program %s",
-			       strsignal (WTERMSIG (status)),
-			       commands[i].prog);
+	      /* The user (or environment) did something to the
+		 inferior.  Making this an ICE confuses the user into
+		 thinking there's a compiler bug.  Much more likely is
+		 the user or OOM killer nuked it.  */
+	      fatal_error (input_location,
+			   "%s signal terminated program %s",
+			   strsignal (WTERMSIG (status)),
+			   commands[i].prog);
+	      break;
+
+#ifdef SIGPIPE
+	    case SIGPIPE:
+	      /* SIGPIPE is a special case.  It happens in -pipe mode
+		 when the compiler dies before the preprocessor is
+		 done, or the assembler dies before the compiler is
+		 done.  There's generally been an error already, and
+		 this is just fallout.  So don't generate another
+		 error unless we would otherwise have succeeded.  */
+	      if (signal_count || greatest_status >= MIN_FATAL_STATUS)
+		{
+		  signal_count++;
+		  ret_code = -1;
 		  break;
-		default:
-		  /* The inferior failed to catch the signal.  */
-		  internal_error_no_backtrace ("%s (program %s)",
-					       strsignal (WTERMSIG (status)),
-					       commands[i].prog);
 		}
-	  }
+#endif
+	      /* FALLTHROUGH */
+
+	    default:
+	      /* The inferior failed to catch the signal.  */
+	      internal_error_no_backtrace ("%s signal terminated program %s",
+					   strsignal (WTERMSIG (status)),
+					   commands[i].prog);
+	    }
 	else if (WIFEXITED (status)
 		 && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
 	  {

                 reply	other threads:[~2017-08-28 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fedd15b1-7313-3d84-b913-83679e5717be@acm.org \
    --to=nathan@acm.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).