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]

Re: Disabling top level fixincludes


Bruce Korb wrote:

> C.F.: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01393.html

Attached is a revised patch.

Once this is applied, and PR17991 is resolved, fixincludes will build on
MinGW.

Aaron W. LaFramboise

2004-10-15  Aaron W. LaFramboise <aaronavay62@aaronwl.com>

	* fixincl.c (SIGCHLD): Remove definition.
	(initialize): Remove SIGIOT and SIGPIPE checks.
	(create_file): Fix mkdir() for Win32.
	(internal_fix): Use dup2() instead of fcntl().
	* fixlib.h (SIGQUIT): Define if undefined.
	(SIGIOT): Same.
	(SIGPIPE): Same.
	(SIGALRM): Same.
	(SIGKILL): Same.
	* procopen.c (chain_open): Use dup2() instead of fcntl().

Index: gcc/fixincludes/fixincl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/fixincl.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 fixincl.c
*** gcc/fixincludes/fixincl.c	15 Oct 2004 07:58:38 -0000	1.2
--- gcc/fixincludes/fixincl.c	15 Oct 2004 23:12:15 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 30,38 ****
  #define  BAD_ADDR ((void*)-1)
  #endif
  
- #if ! defined( SIGCHLD ) && defined( SIGCLD )
- #  define SIGCHLD SIGCLD
- #endif
  #ifndef SEPARATE_FIX_PROC
  #include "server.h"
  #endif
--- 30,35 ----
*************** initialize ( int argc, char** argv )
*** 291,302 ****
  # endif
  
    signal (SIGQUIT, SIG_IGN);
- #ifdef SIGIOT
    signal (SIGIOT,  SIG_IGN);
- #endif
- #ifdef SIGPIPE
    signal (SIGPIPE, SIG_IGN);
- #endif
    signal (SIGALRM, SIG_IGN);
    signal (SIGTERM, SIG_IGN);
  }
--- 288,295 ----
*************** create_file (void)
*** 552,558 ****
--- 545,555 ----
            *pz_dir = NUL;
            if (stat (fname, &stbf) < 0)
              {
+ #ifdef _WIN32
+               mkdir (fname);
+ #else
                mkdir (fname, S_IFDIR | S_DIRALL);
+ #endif
              }
  
            *pz_dir = '/';
*************** internal_fix (int read_fd, tFixDesc* p_f
*** 835,842 ****
     *  Make the fd passed in the stdin, and the write end of
     *  the new pipe become the stdout.
     */
!   fcntl (fd[1], F_DUPFD, STDOUT_FILENO);
!   fcntl (read_fd, F_DUPFD, STDIN_FILENO);
  
    apply_fix (p_fixd, pz_curr_file);
    exit (0);
--- 832,839 ----
     *  Make the fd passed in the stdin, and the write end of
     *  the new pipe become the stdout.
     */
!   dup2 (fd[1], STDOUT_FILENO);
!   dup2 (read_fd, STDIN_FILENO);
  
    apply_fix (p_fixd, pz_curr_file);
    exit (0);
Index: gcc/fixincludes/fixlib.h
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/fixlib.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 fixlib.h
*** gcc/fixincludes/fixlib.h	15 Oct 2004 07:58:38 -0000	1.2
--- gcc/fixincludes/fixlib.h	15 Oct 2004 23:12:15 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 40,45 ****
--- 40,65 ----
  # define STDOUT_FILENO  1
  #endif
  
+ #if ! defined( SIGCHLD ) && defined( SIGCLD )
+ #  define SIGCHLD SIGCLD
+ #endif
+ 
+ #ifndef SIGQUIT
+ #define SIGQUIT SIGTERM
+ #endif
+ #ifndef SIGIOT
+ #define SIGIOT SIGTERM
+ #endif
+ #ifndef SIGPIPE
+ #define SIGPIPE SIGTERM
+ #endif
+ #ifndef SIGALRM
+ #define SIGALRM SIGTERM
+ #endif
+ #ifndef SIGKILL
+ #define SIGKILL SIGTERM
+ #endif
+ 
  typedef int t_success;
  
  #define FAILURE         (-1)
Index: gcc/fixincludes/procopen.c
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/procopen.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 procopen.c
*** gcc/fixincludes/procopen.c	31 Aug 2004 09:26:05 -0000	1.1
--- gcc/fixincludes/procopen.c	15 Oct 2004 23:12:15 -0000
*************** chain_open (int stdin_fd, tCC** pp_args,
*** 155,162 ****
     *  Make the fd passed in the stdin, and the write end of
     *  the new pipe become the stdout.
     */
!   fcntl (stdout_pair.write_fd, F_DUPFD, STDOUT_FILENO);
!   fcntl (stdin_fd, F_DUPFD, STDIN_FILENO);
  
    if (*pp_args == (char *) NULL)
      *pp_args = pz_cmd;
--- 155,162 ----
     *  Make the fd passed in the stdin, and the write end of
     *  the new pipe become the stdout.
     */
!   dup2 (stdout_pair.write_fd, STDOUT_FILENO);
!   dup2 (stdin_fd, STDIN_FILENO);
  
    if (*pp_args == (char *) NULL)
      *pp_args = pz_cmd;

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