From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] New "make check-headers" rule.
Date: Mon, 13 Jan 2014 19:42:00 -0000 [thread overview]
Message-ID: <52D441B5.20307@redhat.com> (raw)
In-Reply-To: <87y54qvfw1.fsf@fleche.redhat.com>
On 11/14/2013 09:21 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> New "make check-headers" rule.
>
> It seems like a good idea to me.
>
> Pedro> +check-headers:
> Pedro> + @echo Checking headers.
> Pedro> + for i in $(CHECK_HEADERS) ; do \
> Pedro> + $(NODEPS_COMPILE) -Wno-error $(PYTHON_CFLAGS) -include defs.h \
> Pedro> + $(srcdir)/$$i -o /dev/null ; \
> Pedro> + done
>
> I'm curious why -Wno-error.
No good reason, I'm afraid.
> Also why not -fsyntax-only?
It hadn't crossed my radar.
Looking at it, I wasn't sure it was the exact same -- e.g.,
whether it expanded C++ templates, but google convinced me it
does. I looked over gcc's codebase (grep for flag_syntax_only)
and I saw things like folding and optimization possibly behaving
differently when that flag in enabled. I was going to prefer
not using the flag on those grounds, but then I timed it:
make check-headers w/ -o /dev/null
real 1m35.383s
user 0m44.862s
sys 0m8.140s
make check-headers w/ -fsyntax-only:
real 0m42.648s
user 0m32.563s
sys 0m7.891s
That's a considerable difference, so that convinced me.
Nice one.
If that flag indeed causes a difference of visible
behavior wrt to errors detected, I guess I'll call it
a gcc bug.
One extra thing we discussed offline is that with
-fsyntax-only, gcc needs to be told the language being
compiled explicitly ("-x c"), otherwise we get:
$ gcc -c -fsyntax-only (...)
cc1: error: output filename specified twice
Below's what I pushed.
Thanks.
----------
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/
2014-01-13 Pedro Alves <palves@redhat.com>
* Makefile.in (CHECK_HEADERS): New variable.
(check-headers:): New rule.
---
gdb/ChangeLog | 5 +++++
gdb/Makefile.in | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6cdafcc..18ed4d3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-13 Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (CHECK_HEADERS): New variable.
+ (check-headers:): New rule.
+
2014-01-13 Tom Tromey <tromey@redhat.com>
* cli/cli-setshow.c (do_set_command): Update.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 824b26b..9811cbe 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1050,6 +1050,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 \
+ $(CC) -x c -c -fsyntax-only $(INTERNAL_CFLAGS) \
+ -include defs.h $(srcdir)/$$i ; \
+ 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
--
1.7.11.7
next prev parent reply other threads:[~2014-01-13 19:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 6:38 [RFA/commit 1/3] language.h: Add "symtab.h" #include Joel Brobecker
2013-11-11 6:39 ` [RFA 2/3] New function cli-utils.c:extract_arg_const Joel Brobecker
2013-11-13 19:35 ` Pedro Alves
2013-11-14 10:55 ` pushed: " Joel Brobecker
2013-11-11 6:55 ` [RFC 3/3] GDB/MI: Add new "--language LANG" command option Joel Brobecker
2013-11-11 7:02 ` Joel Brobecker
2013-11-11 17:20 ` Eli Zaretskii
2013-11-11 16:29 ` Eli Zaretskii
2013-11-13 19:49 ` Pedro Alves
2013-11-14 11:17 ` Joel Brobecker
2013-11-13 19:34 ` [PATCH] New "make check-headers" rule. (was: Re: [RFA/commit 1/3] language.h: Add "symtab.h" #include) Pedro Alves
2013-11-14 10:00 ` Joel Brobecker
2013-11-14 21:32 ` [PATCH] New "make check-headers" rule Tom Tromey
2014-01-13 19:42 ` Pedro Alves [this message]
2013-11-14 10:55 ` pushed: [RFA/commit 1/3] language.h: Add "symtab.h" #include Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52D441B5.20307@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox