New "make check-headers" rule.
authorPedro Alves <palves@redhat.com>
Mon, 13 Jan 2014 19:36:38 +0000 (19:36 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 13 Jan 2014 19:36:38 +0000 (19:36 +0000)
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
gdb/Makefile.in

index 6cdafccb19beba19808198a5d859c6ec7f8a15fb..18ed4d3c2de0d9f2570a677452b208a62e14cf74 100644 (file)
@@ -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.
index 824b26b8b21670426921ca8f1a818fa8751a4d3b..9811cbed43ae82002533d6ca09660f99b7028e71 100644 (file)
@@ -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