From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12184 invoked by alias); 16 Mar 2011 13:17:31 -0000 Received: (qmail 12173 invoked by uid 22791); 16 Mar 2011 13:17:30 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Mar 2011 13:17:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3BCE92BAE53; Wed, 16 Mar 2011 09:17:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bzjNnq9OIYu5; Wed, 16 Mar 2011 09:17:22 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id EAFA92BAE46; Wed, 16 Mar 2011 09:17:21 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D52541459B0; Wed, 16 Mar 2011 17:17:17 +0400 (RET) Date: Wed, 16 Mar 2011 13:58:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add 'getthrds' declaration check in configure for AIX Message-ID: <20110316131717.GP31264@adacore.com> References: <1300231553-27938-1-git-send-email-brobecker@adacore.com> <201103160017.45295.pedro@codesourcery.com> <20110316014023.GO31264@adacore.com> <201103161144.26628.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <201103161144.26628.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00840.txt.bz2 --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 151 > I just thought it made sense to keep the aix thread support > checks together, That works for me. Here is a new patch, tested on AIX 5.3. -- Joel --SLDf9lqlvOQaIe6s Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="aix-getthrds.diff" Content-length: 3446 commit 29e65e51e7344d6a2a68a887013b3c732914b056 Author: Joel Brobecker Date: Tue Mar 15 10:58:39 2011 -0700 Add 'getthrds' declaration check in configure for AIX On newer versions of AIX (6.x and later), this function is actually declared in procinfo.h, thus causing a compilation warning when we re-declare it ourselves. This patch adds a configure check for that function allowing us to declare the function only if the declaration isn't already present in one of procinfo system header. gdb/ChangeLog: PR gdb/12116: * configure.ac: Add getthrds declaration check. * configure, config.in: Regenerate. * aix-thread.c (getthrds): Declare only if not already declared in procinfo.h. More declaration out of get_signaled_thread to global scope. diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 37b798a..c5db262 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -58,6 +58,10 @@ #include #include +#if !HAVE_DECL_GETTHRDS +extern int getthrds (pid_t, struct thrdsinfo64 *, int, pthdb_tid_t *, int); +#endif + /* Whether to emit debugging output. */ static int debug_aix_thread; @@ -647,10 +651,6 @@ get_signaled_thread (void) pthdb_tid_t ktid = 0; int result = 0; - /* getthrds(3) isn't prototyped in any AIX 4.3.3 #include file. */ - extern int getthrds (pid_t, struct thrdsinfo64 *, - int, pthdb_tid_t *, int); - while (1) { if (getthrds (PIDGET (inferior_ptid), &thrinf, diff --git a/gdb/config.in b/gdb/config.in index ccceabf..01ba750 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -118,6 +118,10 @@ */ #undef HAVE_DECL_GETOPT +/* Define to 1 if you have the declaration of `getthrds', and to 0 if you + don't. */ +#undef HAVE_DECL_GETTHRDS + /* Define to 1 if you have the declaration of `malloc', and to 0 if you don't. */ #undef HAVE_DECL_MALLOC diff --git a/gdb/configure b/gdb/configure index 5ee5ce6..92818a0 100755 --- a/gdb/configure +++ b/gdb/configure @@ -14487,6 +14487,22 @@ $as_echo "$gdb_cv_have_aix_thread_debug" >&6; } CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" CONFIG_OBS="${CONFIG_OBS} aix-thread.o" CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug" + + # Older versions of AIX do not provide the declaration for + # the getthrds function (it appears that it was introduced + # with AIX 6.x). + ac_fn_c_check_decl "$LINENO" "getthrds" "ac_cv_have_decl_getthrds" "#include +" +if test "x$ac_cv_have_decl_getthrds" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETTHRDS $ac_have_decl +_ACEOF + fi ;; esac diff --git a/gdb/configure.ac b/gdb/configure.ac index d2b75f6..96e0a7b 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1593,6 +1593,11 @@ if test ${build} = ${host} -a ${host} = ${target} ; then CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" CONFIG_OBS="${CONFIG_OBS} aix-thread.o" CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug" + + # Older versions of AIX do not provide the declaration for + # the getthrds function (it appears that it was introduced + # with AIX 6.x). + AC_CHECK_DECLS(getthrds, [], [], [[#include ]]) fi ;; esac --SLDf9lqlvOQaIe6s--