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: Import John David Anglin's patch to collect2.c onto gcc 3.3branch


Hi Hans-Peter,

> Aww.  This looks like it's likely to cause "pid" to collide with
> some other stuff called "pid" pulled in from a system library
> together with whatever.  If you really, really need to rename
> it, why not initialize it to -1 so it'd not a COMMON symbol
> (those that will merge with any other symbol).

It does not really really need to be called pid, it just really really
needs to be the same named global variable throughout the collect2
code :-)

How about this patch to change the name back to pexecute_pid.  Shall I
apply it to gcc 3.3 and the mainline ?

Cheers
        Nick
        
2003-10-01  Nick Clifton  <nickc@redhat.com>

	* collect2.c (pexecute_pid): Rename from 'pid' to avoid
	conflict with similarly named variables in system libraries.

Index: gcc/collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.142.4.2
diff -c -3 -p -r1.142.4.2 collect2.c
*** gcc/collect2.c	1 Oct 2003 14:08:34 -0000	1.142.4.2
--- gcc/collect2.c	1 Oct 2003 15:46:04 -0000
*************** struct obstack temporary_obstack;
*** 234,240 ****
  char * temporary_firstobj;
  
  /* Holds the return value of pexecute.  */
! int pid;
  
  /* Structure to hold all the directories in which to search for files to
     execute.  */
--- 234,240 ----
  char * temporary_firstobj;
  
  /* Holds the return value of pexecute.  */
! int pexecute_pid;
  
  /* Structure to hold all the directories in which to search for files to
     execute.  */
*************** collect_wait (prog)
*** 1499,1505 ****
  {
    int status;
  
!   pwait (pid, &status, 0);
    if (status)
      {
        if (WIFSIGNALED (status))
--- 1499,1505 ----
  {
    int status;
  
!   pwait (pexecute_pid, &status, 0);
    if (status)
      {
        if (WIFSIGNALED (status))
*************** collect_execute (prog, argv, redir)
*** 1588,1596 ****
        dup2 (redir_handle, STDERR_FILENO);
      }
  
!   pid = pexecute (argv[0], argv, argv[0], NULL,
! 		  &errmsg_fmt, &errmsg_arg,
! 		  (PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH));
  
    if (redir)
      {
--- 1588,1596 ----
        dup2 (redir_handle, STDERR_FILENO);
      }
  
!   pexecute_pid = pexecute (argv[0], argv, argv[0], NULL,
! 			   &errmsg_fmt, &errmsg_arg,
! 			   (PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH));
  
    if (redir)
      {
*************** collect_execute (prog, argv, redir)
*** 1602,1608 ****
        close (redir_handle);
      }
  
!  if (pid == -1)
     fatal_perror (errmsg_fmt, errmsg_arg);
  }
  
--- 1602,1608 ----
        close (redir_handle);
      }
  
!  if (pexecute_pid == -1)
     fatal_perror (errmsg_fmt, errmsg_arg);
  }
  
*************** scan_prog_file (prog_name, which_pass)
*** 2111,2121 ****
    fflush (stderr);
  
    /* Spawn child nm on pipe */
!   pid = vfork ();
!   if (pid == -1)
      fatal_perror (VFORK_STRING);
  
!   if (pid == 0)			/* child context */
      {
        /* setup stdout */
        if (dup2 (pipe_fd[1], 1) < 0)
--- 2111,2121 ----
    fflush (stderr);
  
    /* Spawn child nm on pipe */
!   pexecute_pid = vfork ();
!   if (pexecute_pid == -1)
      fatal_perror (VFORK_STRING);
  
!   if (pexecute_pid == 0)			/* child context */
      {
        /* setup stdout */
        if (dup2 (pipe_fd[1], 1) < 0)
*************** scan_libraries (prog_name)
*** 2552,2562 ****
    fflush (stderr);
  
    /* Spawn child ldd on pipe */
!   pid = vfork ();
!   if (pid == -1)
      fatal_perror (VFORK_STRING);
  
!   if (pid == 0)			/* child context */
      {
        /* setup stdout */
        if (dup2 (pipe_fd[1], 1) < 0)
--- 2552,2562 ----
    fflush (stderr);
  
    /* Spawn child ldd on pipe */
!   pexecute_pid = vfork ();
!   if (pexecute_pid == -1)
      fatal_perror (VFORK_STRING);
  
!   if (pexecute_pid == 0)			/* child context */
      {
        /* setup stdout */
        if (dup2 (pipe_fd[1], 1) < 0)
        


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