From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7433 invoked by alias); 26 Apr 2013 18:45:06 -0000 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 Received: (qmail 7416 invoked by uid 89); 26 Apr 2013 18:45:05 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Apr 2013 18:45:03 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3QIj2V1023870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Apr 2013 14:45:02 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3QIj0nv017601; Fri, 26 Apr 2013 14:45:01 -0400 Message-ID: <517ACB2C.2030006@redhat.com> Date: Fri, 26 Apr 2013 21:01:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: RFC: introduce common.m4 References: <871u9zomzd.fsf@fleche.redhat.com> <51782A71.7030305@redhat.com> <87obd3n4c8.fsf@fleche.redhat.com> <51782CC6.9040008@redhat.com> <871u9zn0wa.fsf@fleche.redhat.com> In-Reply-To: <871u9zn0wa.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00823.txt.bz2 On 04/24/2013 09:12 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> I think you misunderstood the question. > > Indeed. Sorry about that. > >>> The rule I propose is that if something is needed or used by common, >>> it should be checked for by common.m4; but that code outside this >>> directory also be free to use these results. This means that removing >>> checks from common.m4 must first be preceded by looking at uses in gdb >>> and gdbserver. I think this is pretty easy to do -- easier than what >>> we are doing now -- and I have documented the requirement. > > Pedro> over keeping common aware of the checks it needs to do (in common.m4), > Pedro> and gdb/ and gdbserver/ also doing the checks they need for code under > Pedro> gdb/ and gdbserver/ respectively. > > Pedro> Of course the current status of needing to update gdb and gdbserver in > Pedro> parallel for common/ things is no good. > > Yeah, there is no deep reason for it other than wanting to avoid > duplicate checks. The cache would work fine for the performance aspect. > I can certainly just drop the configure.ac changes if you think that > yields a better result. So, we have: $ grep "HAVE_LINUX_PERF_EVENT_H\|HAVE_LOCALE_H\|HAVE_MEMORY_H\|HAVE_SIGNAL_H\|HAVE_STRING_H\|HAVE_STRINGS_H\|HAVE_SYS_RESOURCE_H\|HAVE_SYS_UN_H\|HAVE_SYS_WAIT_H\|HAVE_THREAD_DB_H\|HAVE_WAIT_H" gdb/*.[ch] gdb/gdbserver/*.[ch] gdb/m32c-tdep.c:#if defined (HAVE_STRING_H) gdb/utils.c:#ifdef HAVE_SYS_RESOURCE_H gdb/utils.c:#endif /* HAVE_SYS_RESOURCE_H */ gdb/gdbserver/gdbreplay.c:#if HAVE_SIGNAL_H gdb/gdbserver/gdbreplay.c:#ifdef HAVE_STRING_H gdb/gdbserver/remote-utils.c:#if HAVE_SIGNAL_H gdb/gdbserver/server.c:#if HAVE_SIGNAL_H gdb/gdbserver/server.h:#ifdef HAVE_STRING_H This actually reveals that m32c-tdep.c, gdbreplay.c and server.h should be including gdb_string.h (or nothing) instead of signal.h directly. That'd leave a check for sys/resource.h in gdb, and a check for signal.h in gdbserver. $ grep "HAVE_DECL_STRERROR\|HAVE_DECL_STRSTR" gdb/*.[ch] gdb/gdbserver/*.[ch] gdb/gdbserver/server.h:#if !HAVE_DECL_STRERROR shows that server.h is doing what gdb_string.h already does with that HAVE_DECL_STRERROR check, so that bit could be removed when server.h is made to include gdb_string.h. And: $ grep "HAVE_FDWALK\|HAVE_GETRLIMIT\|HAVE_PIPE\|HAVE_PIPE2\|HAVE_SOCKETPAIR" gdb/*.[ch] gdb/gdbserver/*.[ch] gdb/ser-pipe.c:#if !HAVE_SOCKETPAIR gdb/ser-pipe.c:#if !HAVE_SOCKETPAIR gdb/utils.c:#ifdef HAVE_GETRLIMIT gdb/utils.c:#endif /* HAVE_GETRLIMIT */ Shows we would leave checks for socketpair/getrlimit in gdb/. IMO, it's a little better if each subdirectory treats the others more as black boxes. gdb/ relying on common/'s HAVE_FOO checks feels like gdb/ relying on common/'s implementation details to me. But I don't want to impose. Thanks, -- Pedro Alves