Add a sanity check for installed private headers.

If an installed header has an associated *.cc file (in the source
tree), but does not declare any SPOT_API symbol, something is fishy.
Either that header should not be installed, or it is missing the
SPOT_API markers.

* src/sanity/private.test: New test.
* src/sanity/Makefile.am: Call it.
* src/ltlast/Makefile.am: Do not install formula_tree.hh.
* src/ltlvisit/Makefile.am: Do not install mark.hh.
* src/tgbaalgos/Makefile.am: Do not intall weight.hh.
This commit is contained in:
Alexandre Duret-Lutz 2013-06-28 23:45:25 +02:00
parent cfbd31384f
commit aeca44e0b1
5 changed files with 49 additions and 8 deletions

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8 -*-
## Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et
## Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
## Développement de l'Epita (LRDE).
## Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -51,13 +51,21 @@ check-local: check-80columns check-style check-readme check-includes
# Ensure we have not forgotten to include an header.
installcheck-local:
check-installed-includes:
CXX='$(CXX)' \
CPPFLAGS='-I $(includedir) -I$(pkgincludedir) $(LIBGSPN_CPPFLAGS) $(CPPFLAGS)' \
CXXFLAGS='$(AM_CXXFLAGS) $(CXXFLAGS)' \
INCDIR='$(pkgincludedir)' \
$(SHELL) $(srcdir)/includes.test $(TESTHEADER)
# Any installed header should contain a SPOT_API tag somewhere.
check-installed-private:
INCDIR='$(pkgincludedir)' \
SRCDIR='$(top_srcdir)/src' \
$(SHELL) $(srcdir)/private.test $(TESTHEADER)
installcheck-local: check-installed-includes check-installed-private
CLEANFILES = failures incltest.*
EXTRA_DIST = includes.test 80columns.test style.test readme.test
EXTRA_DIST = includes.test 80columns.test style.test readme.test private.test

33
src/sanity/private.test Executable file
View file

@ -0,0 +1,33 @@
#! /bin/sh
# Make sure we do not install privated header, i.e., headers that
# declare unexported functions. We catch these by checking for
# headers that have no SPOT_API occurrence, but that have an ssociated
# *.cc file.
set -e
rm -f failures
# Remove any trailing slash
INCDIR=${INCDIR%/}
for file in `find "$INCDIR" \( -name "${1-*}.hh" \
-o -name "${1-*}.hxx" \) \
-a -type f -a -print | sed "s,$INCDIR/,,g"`; do
if grep SPOT_API "$INCDIR/$file" >/dev/null; then
:
elif test -f "$SRCDIR/${file%.*}.cc"; then
echo "FAIL: $file -- no exported symbol, should this file be private?"
echo " $file" >> failures
fi
done
if test -f failures; then
echo "Failed files:"
cat failures
rm failures
exit 1;
fi