From 422d46d06a84d0b8194a53de4ad242dbeea85c52 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 15 Aug 2011 08:36:04 +0100 Subject: [PATCH] header: Fix including just . Also this adds a regression test so we don't break it in future. --- .gitignore | 1 + generator/generator.ml | 1 + lib/Makefile.am | 15 ++++++++++++++- lib/test-just-header.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 lib/test-just-header.c diff --git a/.gitignore b/.gitignore index 8b06c6a..cf49940 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ lib/*.3 lib/hivex.h lib/hivex.pod lib/hivex.syms +lib/test-just-header lib/tools/*.opt .libs libtool diff --git a/generator/generator.ml b/generator/generator.ml index 943039c..d8efc04 100755 --- a/generator/generator.ml +++ b/generator/generator.ml @@ -704,6 +704,7 @@ let rec generate_c_header () = #ifndef HIVEX_H_ #define HIVEX_H_ +#include #include #ifdef __cplusplus diff --git a/lib/Makefile.am b/lib/Makefile.am index 7e5b92b..12f415a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,5 @@ # hivex -# Copyright (C) 2009-2010 Red Hat Inc. +# Copyright (C) 2009-2011 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -63,3 +63,16 @@ $(top_builddir)/html/hivex.3.html: hivex.pod $< CLEANFILES = $(man_MANS) + +# Tests. + +check_PROGRAMS = test-just-header + +TESTS = test-just-header + +test_just_header_SOURCES = test-just-header.c +test_just_header_CFLAGS = \ + -I$(top_srcdir)/lib -I$(top_builddir)/lib \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) +test_just_header_LDADD = \ + $(top_builddir)/lib/libhivex.la diff --git a/lib/test-just-header.c b/lib/test-just-header.c new file mode 100644 index 0000000..ee81e21 --- /dev/null +++ b/lib/test-just-header.c @@ -0,0 +1,30 @@ +/* hivex + * Copyright (C) 2010-2011 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/* Check that just including the header and nothing else works, ie. + * that there are no implicit dependencies in the header file. + */ + +#include "hivex.h" + +int +main (int argc, char *argv[]) +{ + hive_h *h = hivex_open ("../images/minimal", 0); + return 0; +} -- 1.8.3.1