This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
egcs-CVS19980628, GCC_NEED_DECLARATION search additional headers patch
- To: egcs-patches at cygnus dot com
- Subject: egcs-CVS19980628, GCC_NEED_DECLARATION search additional headers patch
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 29 Jun 1998 10:39:47 -0400 (EDT)
- Cc: law at cygnus dot com
This patch adds some functionality to GCC_NEED_DECLARATION{S} so
that we can search in arbitrary header files for declarations. It also
adds checks for getrlimit/setrlimit in sys/resource.h which make use of
this new functionailty.
Okay to install?
--Kaveh
Sun Jun 28 16:19:15 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* aclocal.m4 (GCC_NEED_DECLARATION): Accept an optional second
argument, which is typically preprocessor code used to draw in
additional header files when looking for a function declaration.
(GCC_NEED_DECLARATIONS): Likewise.
* configure.in (GCC_NEED_DECLARATIONS): Add checks for getrlimit
and setrlimit, search for them in sys/resource.h.
* acconfig.h: Add stubs for NEED_DECLARATION_GETRLIMIT and
NEED_DECLARATION_SETRLIMIT.
* system.h: Prototype getrlimit/setrlimit if necessary.
diff -rup orig/egcs-CVS19980628/gcc/acconfig.h egcs-CVS19980628/gcc/acconfig.h
--- orig/egcs-CVS19980628/gcc/acconfig.h Sun Jun 28 09:22:40 1998
+++ egcs-CVS19980628/gcc/acconfig.h Sun Jun 28 15:53:29 1998
@@ -64,4 +64,10 @@
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
+
+/* Whether getrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_GETRLIMIT
+
+/* Whether setrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_SETRLIMIT
@TOP@
diff -rup orig/egcs-CVS19980628/gcc/aclocal.m4 egcs-CVS19980628/gcc/aclocal.m4
--- orig/egcs-CVS19980628/gcc/aclocal.m4 Sun Jun 28 09:22:40 1998
+++ egcs-CVS19980628/gcc/aclocal.m4 Sun Jun 28 16:11:15 1998
@@ -1,4 +1,5 @@
dnl See whether we need a declaration for a function.
+dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(gcc_cv_decl_needed_$1,
@@ -22,7 +23,8 @@ AC_CACHE_VAL(gcc_cv_decl_needed_$1,
#endif
#ifndef HAVE_INDEX
#define index strchr
-#endif],
+#endif
+$2],
[char *(*pfn) = (char *(*)) $1],
eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
@@ -35,10 +37,11 @@ fi
])dnl
dnl Check multiple functions to see whether each needs a declaration.
+dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATIONS,
[for ac_func in $1
do
-GCC_NEED_DECLARATION($ac_func)
+GCC_NEED_DECLARATION($ac_func, $2)
done
])
diff -rup orig/egcs-CVS19980628/gcc/configure.in egcs-CVS19980628/gcc/configure.in
--- orig/egcs-CVS19980628/gcc/configure.in Sun Jun 28 09:22:52 1998
+++ egcs-CVS19980628/gcc/configure.in Sun Jun 28 16:10:18 1998
@@ -199,6 +199,13 @@ GCC_FUNC_PRINTF_PTR
GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof strerror getcwd getwd)
+GCC_NEED_DECLARATIONS(getrlimit setrlimit, [
+#include <sys/types.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+])
+
AC_DECL_SYS_SIGLIST
# File extensions
diff -rup orig/egcs-CVS19980628/gcc/system.h egcs-CVS19980628/gcc/system.h
--- orig/egcs-CVS19980628/gcc/system.h Sun Jun 28 09:23:49 1998
+++ egcs-CVS19980628/gcc/system.h Sun Jun 28 15:58:59 1998
@@ -229,6 +229,22 @@ extern int sys_nerr;
extern char *sys_errlist[];
#endif /* HAVE_STRERROR */
+#ifdef HAVE_GETRLIMIT
+# ifdef NEED_DECLARATION_GETRLIMIT
+# ifndef getrlimit
+extern int getrlimit ();
+# endif
+# endif
+#endif
+
+#ifdef HAVE_SETRLIMIT
+# ifdef NEED_DECLARATION_SETRLIMIT
+# ifndef setrlimit
+extern int setrlimit ();
+# endif
+# endif
+#endif
+
/* HAVE_VOLATILE only refers to the stage1 compiler. We also check
__STDC__ and assume gcc sets it and has volatile in stage >=2. */
#if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile)