From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22092 invoked by alias); 13 Nov 2013 19:03:45 -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 22081 invoked by uid 89); 13 Nov 2013 19:03:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Nov 2013 19:03:43 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rADJ3YZe026624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Nov 2013 14:03:34 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rADJ3Wq5009269; Wed, 13 Nov 2013 14:03:33 -0500 Message-ID: <5283CD04.3080501@redhat.com> Date: Wed, 13 Nov 2013 19:34:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: [PATCH] New "make check-headers" rule. (was: Re: [RFA/commit 1/3] language.h: Add "symtab.h" #include) References: <1384151855-12926-1-git-send-email-brobecker@adacore.com> In-Reply-To: <1384151855-12926-1-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2013-11/txt/msg00351.txt.bz2 On 11/11/2013 06:37 AM, Joel Brobecker wrote: > Hello, > > I noticed this when I tried to #include "language.h" from mi-parse.c, > when I got compilation errors from missing type declarations: > > In addition to the fact that language.h depends on a number of struct > types declared in symtab.h, language.h also depends on an enumerated > type (domain_enum). So language.h should #include "symtab.h". > > gdb/ChangeLog: > > * language.h: Add "symtab.h" #include. > > Tested on x86_64-linux. I think this patch should go in on its own. Agreed. I wonder what people think of something like the patch below. $ make check-headers CHECK_HEADERS="language.h" Checking headers. for i in language.h ; do \ gcc -g3 -O0 -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../src/gdb/gnulib/import -Ibuild-gnulib/import -DTUI=1 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o check-headers -Wno-error -fno-strict-aliasing -DNDEBUG -fwrapv -include defs.h \ ../../src/gdb/$i -o /dev/null ; \ done ../../src/gdb/language.h:200:17: warning: ‘struct symbol’ declared inside parameter list [enabled by default] ../../src/gdb/language.h:200:17: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] ../../src/gdb/language.h:242:13: warning: ‘struct symbol’ declared inside parameter list [enabled by default] ../../src/gdb/language.h:263:14: warning: type defaults to ‘int’ in declaration of ‘domain_enum’ [-Wimplicit-int] ../../src/gdb/language.h:263:8: warning: ‘struct block’ declared inside parameter list [enabled by default] ../../src/gdb/language.h:294:5: error: expected specifier-qualifier-list before ‘VEC’ make: *** [check-headers] Error 1 After your patch, the above comes out clean. ------------- New "make check-headers" rule. Tries to compile each header in isolation, thus ensuring headers are self-contained. Defaults to checking all $HFILES_NO_SRCDIR headers. Do: make check-headers CHECK_HEADERS="header.h list.h" to check specific headers. gdb/ 2013-11-13 Pedro Alves * Makefile.in (COMPILE.pre): Rename to ... (NODEPS_COMPILE.pre): ... this. (COMPILE.post): Rename to ... (NODEPS_COMPILE.post): ... this. (COMPILE): Rename to ... (NODEPS_COMPILE): ... this. (COMPILE.pre, COMPILE.post, COMPILE): Reimplement as wrappers around the NODEPS variants. (CHECK_HEADERS): New. (check-headers:): New rule. --- gdb/Makefile.in | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 975edbf..d39b5b4 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -86,11 +86,15 @@ DEPMODE = @CCDEPMODE@ DEPDIR = @DEPDIR@ depcomp = $(SHELL) $(srcdir)/../depcomp +NODEPS_COMPILE.pre = $(CC) +NODEPS_COMPILE.post = -c -o $@ +NODEPS_COMPILE = $(NODEPS_COMPILE.pre) $(INTERNAL_CFLAGS) $(NODEPS_COMPILE.post) + # Note that these are overridden by GNU make-specific code below if # GNU make is used. The overrides implement dependency tracking. -COMPILE.pre = $(CC) -COMPILE.post = -c -o $@ -COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post) +COMPILE.pre = $(NODEPS_COMPILE.pre) +COMPILE.post = $(NODEPS_COMPILE.post) +COMPILE = $(NODEPS_COMPILE) POSTCOMPILE = @true # Directory containing source files. @@ -1050,6 +1054,28 @@ check//%: force "$$target"; \ else true; fi +# The set of headers checked by 'check-headers' by default. +CHECK_HEADERS = $(HFILES_NO_SRCDIR) + +# Try to compile each header in isolation, thus ensuring headers are +# self-contained. +# +# Defaults to checking all $HFILES_NO_SRCDIR headers. +# +# Do: +# +# make check-headers CHECK_HEADERS="header.h list.h" +# +# to check specific headers. +# +check-headers: + @echo Checking headers. + for i in $(CHECK_HEADERS) ; do \ + $(NODEPS_COMPILE) -Wno-error $(PYTHON_CFLAGS) -include defs.h \ + $(srcdir)/$$i -o /dev/null ; \ + done +.PHONY: check-headers + info install-info clean-info dvi pdf install-pdf html install-html: force @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do