* [PATCH] Further driver signal cleanup
@ 2017-08-16 19:09 Nathan Sidwell
2017-08-16 19:11 ` Marek Polacek
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2017-08-16 19:09 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
This, almost obvious, patch merges the older SIGPIPE conditional into
the new switch I added. I found the FALLTHROUGH marker needed to be
outside the #if, which was a little annoying.
I changed the backtrace error message to also explicitly say it was a
signal wot did it.
ok?
nathan
--
Nathan Sidwell
[-- Attachment #2: sig-diff --]
[-- Type: text/plain, Size: 2928 bytes --]
2017-08-16 Nathan Sidwell <nathan@acm.org>
* gcc.c (execute): Fold SIGPIPE handling into switch
statement. Adjust internal error message.
Index: gcc.c
===================================================================
--- gcc.c (revision 251119)
+++ gcc.c (working copy)
@@ -3135,44 +3135,45 @@ execute (void)
int status = statuses[i];
if (WIFSIGNALED (status))
- {
+ switch (WTERMSIG (status))
+ {
+ case SIGINT:
+ case SIGQUIT:
+ case SIGKILL:
+ 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);
+ break;
+
#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 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)
{
- case SIGINT:
- case SIGQUIT:
- case SIGKILL:
- 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);
+ 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)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Further driver signal cleanup
2017-08-16 19:09 [PATCH] Further driver signal cleanup Nathan Sidwell
@ 2017-08-16 19:11 ` Marek Polacek
0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2017-08-16 19:11 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: GCC Patches
On Wed, Aug 16, 2017 at 02:24:10PM -0400, Nathan Sidwell wrote:
> This, almost obvious, patch merges the older SIGPIPE conditional into the
> new switch I added. I found the FALLTHROUGH marker needed to be outside the
> #if, which was a little annoying.
True, it needs to precede the casea token. Or you can use gcc_fallthrough ();
which can be inside #if/{}/...
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-16 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-16 19:09 [PATCH] Further driver signal cleanup Nathan Sidwell
2017-08-16 19:11 ` Marek Polacek
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).