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.
This commit is contained in:
Pedro Alves 2014-01-13 19:36:38 +00:00
parent 42c85435d6
commit f71e1a8ddb
2 changed files with 27 additions and 0 deletions

View 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.

View 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