PATCH: libiberty portability

Mark Mitchell mark@codesourcery.com
Tue May 7 11:57:00 GMT 2002


This patch makes libiberty a little more portable; these changes were
needed for WindISS, which has slightly non-POSIXy headers.

Bootstrapped and tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2002-05-07  Mark Mitchell  <mark@codesourcery.com>

	* configure.in (AC_TYPE_PID_T): Use it.
	* configure: Regenerated.
	* getruntime.c: Include <sys/types.h>.
	* waitpid.c: Likewise.  Use pid_t, not int, as the type of "pid".

Index: libiberty/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/configure.in,v
retrieving revision 1.48
diff -c -p -r1.48 configure.in
*** libiberty/configure.in	26 Mar 2002 22:56:51 -0000	1.48
--- libiberty/configure.in	7 May 2002 18:40:36 -0000
*************** then
*** 138,143 ****
--- 138,145 ----
    AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' 
type.])
  fi

+ AC_TYPE_PID_T
+
  # This is the list of functions which libiberty will provide if they
  # are not available on the host.

Index: libiberty/getruntime.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/getruntime.c,v
retrieving revision 1.9
diff -c -p -r1.9 getruntime.c
*** libiberty/getruntime.c	17 Oct 2001 21:15:41 -0000	1.9
--- libiberty/getruntime.c	7 May 2002 18:40:36 -0000
***************
*** 1,5 ****
  /* Return time used so far, in microseconds.
!    Copyright (C) 1994, 1999 Free Software Foundation, Inc.

  This file is part of the libiberty library.
  Libiberty is free software; you can redistribute it and/or
--- 1,5 ----
  /* Return time used so far, in microseconds.
!    Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc.

  This file is part of the libiberty library.
  Libiberty is free software; you can redistribute it and/or
*************** Boston, MA 02111-1307, USA.  */
*** 21,26 ****
--- 21,30 ----

  #include "ansidecl.h"
  #include "libiberty.h"
+
+ /* On some systems (such as WindISS), you must include <sys/types.h>
+    to get the definition of "time_t" before you include <time.h>.  */
+ #include <sys/types.h>

  /* There are several ways to get elapsed execution time; unfortunately no
     single way is available for all host systems, nor are there reliable
Index: libiberty/waitpid.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/waitpid.c,v
retrieving revision 1.4
diff -c -p -r1.4 waitpid.c
*** libiberty/waitpid.c	26 Sep 2001 18:16:17 -0000	1.4
--- libiberty/waitpid.c	7 May 2002 18:40:36 -0000
*************** does the return value.  The third argume
*** 13,25 ****
  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
  #ifdef HAVE_SYS_WAIT_H
  #include <sys/wait.h>
  #endif

! int
  waitpid (pid, stat_loc, options)
! 	int pid, *stat_loc, options;
  {
    for (;;)
      {
--- 13,31 ----
  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
+
+ /* On some systems (such as WindISS), you must include <sys/types.h>
+    to get the definition of "pid_t" before you include <sys/wait.h>.  */
+ #include <sys/types.h>
+
  #ifdef HAVE_SYS_WAIT_H
  #include <sys/wait.h>
  #endif

! pid_t
  waitpid (pid, stat_loc, options)
!      pid_t pid;
!      int *stat_loc, options;
  {
    for (;;)
      {



More information about the Gcc-patches mailing list