Patchwork Boostrap failures on Solaris at gcc/toplev.c stage2 compilation

login
register
mail settings
Submitter Joseph S. Myers
Date Nov. 24, 2010, 5:58 p.m.
Message ID <Pine.LNX.4.64.1011241746440.1678@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/72927/
State New
Headers show

Comments

Joseph S. Myers - Nov. 24, 2010, 5:58 p.m.
On Wed, 24 Nov 2010, Art Haas wrote:

> This morning's build attempts on both i386-pc-solaris2.10 and
> sparc-sun-solaris2.10 failed with the following error:
> 
> /export/home/arth/gnu/gcc-1124/./prev-gcc/xgcc -B/export/home/arth/gnu/gcc-1124/./prev-gcc/ -B/export/home/arth/local/i386-pc-solaris2.10/bin/ -B/export/home/arth/local/i386-pc-solaris2.10/bin/ -B/export/home/arth/local/i386-pc-solaris2.10/lib/ -isystem /export/home/arth/local/i386-pc-solaris2.10/include -isystem /export/home/arth/local/i386-pc-solaris2.10/sys-include    -c   -g -O2 -gtoggle -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I/home/ahaas/gnu/gcc.git/gcc -I/home/ahaas/gnu/gcc.git/gcc/. -I/home/ahaas/gnu/gcc.git/gcc/../include -I/home/ahaas/gnu/gcc.git/gcc/../libcpp/include -I/export/home/arth/local/include -I/export/home/arth/local/include  -I/home/ahaas/gnu/gcc.git/gcc/../libdecnumber -I/home/ahaas/gnu/gcc.git/gcc/../libdecnumber/dpd -I../libdecnumber    /!
>  home/ahaas/gnu/gcc.git/gcc/tree-call-cdce.c -o tree-call-cdce.o
> /home/ahaas/gnu/gcc.git/gcc/toplev.c: In function 'crash_signal':
> /home/ahaas/gnu/gcc.git/gcc/toplev.c:445:3: error: implicit declaration of function 'signal' [-Werror=implicit-function-declaration]
> cc1: all warnings being treated as errors
> 
> The likely cause is this patch applied yesterday:
> 
> 2010-11-23  Joseph Myers  <joseph@codesourcery.com>
>         { ...snip ... }
>         * toplev.c: Don't include <signal.h> or <sys/resource.h>.
>         (setup_core_dumping, strip_off_ending, decode_d_option): Move to
>         opts.c.

I've committed this patch as obvious to fix this.  (With glibc, 
<sys/wait.h> includes <signal.h>, as POSIX permits but does not require, 
which explains why I didn't see this in my testing.)

I do wonder if it really makes sense for <signal.h> includes to go in 
individual source files or whether it would be better to put more headers 
in system.h.  There may be cases where including a system header means you 
need to link in extra libraries - in all programs, not just the compilers 
proper - if it has inline functions (gmp.h and mpfr.h might be like that).  
But otherwise I think more host-side code should avoid including more 
system headers itself.  Particular headers in point: <signal.h> 
<sys/mman.h> <sys/resource.h> <sys/times.h>.  There are also several cases 
of host-side code including headers already included in system.h.

Patch

Index: toplev.c
===================================================================
--- toplev.c	(revision 167122)
+++ toplev.c	(working copy)
@@ -28,6 +28,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include <signal.h>
 
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 167122)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@ 
+2010-11-24  Joseph Myers  <joseph@codesourcery.com>
+
+	* toplev.c: Include <signal.h>.
+
 2010-11-24  Richard Guenther  <rguenther@suse.de>
 
 	PR lto/43218