[PATCH] Avoid double-including config.h

Ulf Hermann ulf.hermann@qt.io
Thu Apr 20 14:31:00 GMT 2017


config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.

In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 lib/ChangeLog                               |  5 +++
 lib/crc32.c                                 |  4 ++
 lib/system.h                                |  4 --
 libdwfl/ChangeLog                           | 58 +++++++++++++++++++++++++++++
 libdwfl/argp-std.c                          |  4 ++
 libdwfl/cu.c                                |  4 ++
 libdwfl/derelocate.c                        |  4 ++
 libdwfl/dwfl_addrdie.c                      |  4 ++
 libdwfl/dwfl_addrdwarf.c                    |  4 ++
 libdwfl/dwfl_addrmodule.c                   |  4 ++
 libdwfl/dwfl_begin.c                        |  4 ++
 libdwfl/dwfl_build_id_find_debuginfo.c      |  4 ++
 libdwfl/dwfl_build_id_find_elf.c            |  4 ++
 libdwfl/dwfl_cumodule.c                     |  4 ++
 libdwfl/dwfl_dwarf_line.c                   |  4 ++
 libdwfl/dwfl_end.c                          |  4 ++
 libdwfl/dwfl_frame.c                        |  4 ++
 libdwfl/dwfl_frame_regs.c                   |  4 ++
 libdwfl/dwfl_getdwarf.c                     |  4 ++
 libdwfl/dwfl_getmodules.c                   |  4 ++
 libdwfl/dwfl_getsrc.c                       |  4 ++
 libdwfl/dwfl_getsrclines.c                  |  4 ++
 libdwfl/dwfl_line_comp_dir.c                |  4 ++
 libdwfl/dwfl_linecu.c                       |  4 ++
 libdwfl/dwfl_lineinfo.c                     |  4 ++
 libdwfl/dwfl_linemodule.c                   |  4 ++
 libdwfl/dwfl_module.c                       |  4 ++
 libdwfl/dwfl_module_addrdie.c               |  4 ++
 libdwfl/dwfl_module_addrname.c              |  4 ++
 libdwfl/dwfl_module_addrsym.c               |  4 ++
 libdwfl/dwfl_module_build_id.c              |  4 ++
 libdwfl/dwfl_module_dwarf_cfi.c             |  4 ++
 libdwfl/dwfl_module_eh_cfi.c                |  4 ++
 libdwfl/dwfl_module_getdwarf.c              |  4 ++
 libdwfl/dwfl_module_getelf.c                |  4 ++
 libdwfl/dwfl_module_getsrc.c                |  4 ++
 libdwfl/dwfl_module_getsrc_file.c           |  4 ++
 libdwfl/dwfl_module_getsym.c                |  4 ++
 libdwfl/dwfl_module_info.c                  |  4 ++
 libdwfl/dwfl_module_nextcu.c                |  4 ++
 libdwfl/dwfl_module_register_names.c        |  4 ++
 libdwfl/dwfl_module_report_build_id.c       |  4 ++
 libdwfl/dwfl_module_return_value_location.c |  4 ++
 libdwfl/dwfl_nextcu.c                       |  4 ++
 libdwfl/dwfl_onesrcline.c                   |  4 ++
 libdwfl/dwfl_report_elf.c                   |  4 ++
 libdwfl/dwfl_validate_address.c             |  4 ++
 libdwfl/dwfl_version.c                      |  4 ++
 libdwfl/find-debuginfo.c                    |  4 ++
 libdwfl/gzip.c                              |  4 ++
 libdwfl/image-header.c                      |  4 ++
 libdwfl/libdwflP.h                          |  3 --
 libdwfl/lines.c                             |  4 ++
 libdwfl/linux-core-attach.c                 |  4 ++
 libdwfl/linux-pid-attach.c                  |  4 ++
 libdwfl/linux-proc-maps.c                   |  4 ++
 libdwfl/offline.c                           |  4 ++
 libdwfl/open.c                              |  4 ++
 libdwfl/relocate.c                          |  4 ++
 libdwfl/segment.c                           |  4 ++
 libelf/ChangeLog                            |  4 ++
 libelf/libelfP.h                            |  4 --
 62 files changed, 291 insertions(+), 11 deletions(-)

diff --git a/lib/ChangeLog b/lib/ChangeLog
index 84290f7..8cac7af 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* crc32.c: include config.h.
+	* system.h: Don't include config.h.
+
 2017-02-16  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am (libeu_a_SOURCES): Remove version.c, add printversion.c
diff --git a/lib/crc32.c b/lib/crc32.c
index 1a76b1b..758602e 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -25,6 +25,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdint.h>
 #include "system.h"
 
diff --git a/lib/system.h b/lib/system.h
index 2d05702..9203335 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -29,10 +29,6 @@
 #ifndef LIB_SYSTEM_H
 #define LIB_SYSTEM_H	1
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <errno.h>
 #include <stddef.h>
 #include <stdint.h>
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 80346d5..cddafe2 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,63 @@
 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* libdwflP.h: Don't include config.h.
+	* argp-std.c: Include config.h.
+	* cu.c: Likewise.
+	* derelocate.c: Likewise.
+	* dwfl_addrdie.c: Likewise.
+	* dwfl_addrdwarf.c: Likewise.
+	* dwfl_addrmodule.c: Likewise.
+	* dwfl_begin.c: Likewise.
+	* dwfl_build_id_find_debuginfo.c: Likewise.
+	* dwfl_build_id_find_elf.c: Likewise.
+	* dwfl_cumodule.c: Likewise.
+	* dwfl_dwarf_line.c: Likewise.
+	* dwfl_end.c: Likewise.
+	* dwfl_frame.c: Likewise.
+	* dwfl_frame_regs.c: Likewise.
+	* dwfl_getdwarf.c: Likewise.
+	* dwfl_getmodules.c: Likewise.
+	* dwfl_getsrc.c: Likewise.
+	* dwfl_getsrclines.c: Likewise.
+	* dwfl_line_comp_dir.c: Likewise.
+	* dwfl_linecu.c: Likewise.
+	* dwfl_lineinfo.c: Likewise.
+	* dwfl_linemodule.c: Likewise.
+	* dwfl_module.c: Likewise.
+	* dwfl_module_addrdie.c: Likewise.
+	* dwfl_module_addrname.c: Likewise.
+	* dwfl_module_addrsym.c: Likewise.
+	* dwfl_module_build_id.c: Likewise.
+	* dwfl_module_dwarf_cfi.c: Likewise.
+	* dwfl_module_eh_cfi.c: Likewise.
+	* dwfl_module_getdarf.c: Likewise.
+	* dwfl_module_getelf.c: Likewise.
+	* dwfl_module_getsrc.c: Likewise.
+	* dwfl_module_getsrc_file.c: Likewise.
+	* dwfl_module_getsym.c: Likewise.
+	* dwfl_module_info.c: Likewise.
+	* dwfl_module_nextcu.c: Likewise.
+	* dwfl_module_register_names.c: Likewise.
+	* dwfl_module_report_build_id.c: Likewise.
+	* dwfl_module_return_value_location.c: Likewise.
+	* dwfl_nextcu.c: Likewise.
+	* dwfl_onesrcline.c: Likewise.
+	* dwfl_report_elf.c: Likewise.
+	* dwfl_validate_address.c: Likewise.
+	* dwfl_version.c: Likewise.
+	* find-debuginfo.c: Likewise.
+	* gzip.c: Likewise.
+	* image-header.c: Likewise.
+	* lines.c: Likewise.
+	* linux-core-attach.c: Likewise.
+	* linux-pid-attach.c: Likewise.
+	* offline.c: Likewise.
+	* open.c: Likewise.
+	* relocate.c: Likewise.
+	* segment.c: Likewise.
+
+2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* linux-kernel-modules.c: Always return NULL from kernel_release() on
 	non-linux systems.
 
diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c
index 501530a..347a05b 100644
--- a/libdwfl/argp-std.c
+++ b/libdwfl/argp-std.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <argp.h>
 #include <stdlib.h>
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index 5182054..7aa23b5 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 #include "../libdw/memory-access.h"
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index 439a24e..e5c3e12 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 struct dwfl_relocation
diff --git a/libdwfl/dwfl_addrdie.c b/libdwfl/dwfl_addrdie.c
index 1e9b3ab..c5b1d68 100644
--- a/libdwfl/dwfl_addrdie.c
+++ b/libdwfl/dwfl_addrdie.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwarf_Die *
diff --git a/libdwfl/dwfl_addrdwarf.c b/libdwfl/dwfl_addrdwarf.c
index ba412ec..4f9efab 100644
--- a/libdwfl/dwfl_addrdwarf.c
+++ b/libdwfl/dwfl_addrdwarf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwarf *
diff --git a/libdwfl/dwfl_addrmodule.c b/libdwfl/dwfl_addrmodule.c
index 9234eb7..abf1ff4 100644
--- a/libdwfl/dwfl_addrmodule.c
+++ b/libdwfl/dwfl_addrmodule.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl_Module *
diff --git a/libdwfl/dwfl_begin.c b/libdwfl/dwfl_begin.c
index 44c16a9..b03f5cf 100644
--- a/libdwfl/dwfl_begin.c
+++ b/libdwfl/dwfl_begin.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl *
diff --git a/libdwfl/dwfl_build_id_find_debuginfo.c b/libdwfl/dwfl_build_id_find_debuginfo.c
index f1c64bc..273e5e5 100644
--- a/libdwfl/dwfl_build_id_find_debuginfo.c
+++ b/libdwfl/dwfl_build_id_find_debuginfo.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <unistd.h>
 
diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
index d4737c9..ee0c164 100644
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <inttypes.h>
 #include <fcntl.h>
diff --git a/libdwfl/dwfl_cumodule.c b/libdwfl/dwfl_cumodule.c
index c5cf004..2b593f2 100644
--- a/libdwfl/dwfl_cumodule.c
+++ b/libdwfl/dwfl_cumodule.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl_Module *
diff --git a/libdwfl/dwfl_dwarf_line.c b/libdwfl/dwfl_dwarf_line.c
index e96f859..e22e984 100644
--- a/libdwfl/dwfl_dwarf_line.c
+++ b/libdwfl/dwfl_dwarf_line.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 
diff --git a/libdwfl/dwfl_end.c b/libdwfl/dwfl_end.c
index 0b35bd2..74ee9e0 100644
--- a/libdwfl/dwfl_end.c
+++ b/libdwfl/dwfl_end.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <unistd.h>
 
diff --git a/libdwfl/dwfl_frame.c b/libdwfl/dwfl_frame.c
index 1dc0c8d..881f735 100644
--- a/libdwfl/dwfl_frame.c
+++ b/libdwfl/dwfl_frame.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <unistd.h>
 
diff --git a/libdwfl/dwfl_frame_regs.c b/libdwfl/dwfl_frame_regs.c
index 10803fe..83b1abe 100644
--- a/libdwfl/dwfl_frame_regs.c
+++ b/libdwfl/dwfl_frame_regs.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 bool
diff --git a/libdwfl/dwfl_getdwarf.c b/libdwfl/dwfl_getdwarf.c
index 8d1d9ba..edd088e 100644
--- a/libdwfl/dwfl_getdwarf.c
+++ b/libdwfl/dwfl_getdwarf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 struct module_callback_info
diff --git a/libdwfl/dwfl_getmodules.c b/libdwfl/dwfl_getmodules.c
index eed9b4f..243cb04 100644
--- a/libdwfl/dwfl_getmodules.c
+++ b/libdwfl/dwfl_getmodules.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 ptrdiff_t
diff --git a/libdwfl/dwfl_getsrc.c b/libdwfl/dwfl_getsrc.c
index 8d4ae02..d853aed 100644
--- a/libdwfl/dwfl_getsrc.c
+++ b/libdwfl/dwfl_getsrc.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl_Line *
diff --git a/libdwfl/dwfl_getsrclines.c b/libdwfl/dwfl_getsrclines.c
index bdfcf5c..1ce78fc 100644
--- a/libdwfl/dwfl_getsrclines.c
+++ b/libdwfl/dwfl_getsrclines.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 int
diff --git a/libdwfl/dwfl_line_comp_dir.c b/libdwfl/dwfl_line_comp_dir.c
index bda09c4..77c3fdf 100644
--- a/libdwfl/dwfl_line_comp_dir.c
+++ b/libdwfl/dwfl_line_comp_dir.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <dwarf.h>
 
diff --git a/libdwfl/dwfl_linecu.c b/libdwfl/dwfl_linecu.c
index ce78d29..2043b17 100644
--- a/libdwfl/dwfl_linecu.c
+++ b/libdwfl/dwfl_linecu.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 #undef dwfl_linecu
diff --git a/libdwfl/dwfl_lineinfo.c b/libdwfl/dwfl_lineinfo.c
index 7ddbfb0..9618712 100644
--- a/libdwfl/dwfl_lineinfo.c
+++ b/libdwfl/dwfl_lineinfo.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 
diff --git a/libdwfl/dwfl_linemodule.c b/libdwfl/dwfl_linemodule.c
index e4a35e0..d243f0d 100644
--- a/libdwfl/dwfl_linemodule.c
+++ b/libdwfl/dwfl_linemodule.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl_Module *
diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c
index 515092f..510bd69 100644
--- a/libdwfl/dwfl_module.c
+++ b/libdwfl/dwfl_module.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/cfi.h"
 #include <search.h>
diff --git a/libdwfl/dwfl_module_addrdie.c b/libdwfl/dwfl_module_addrdie.c
index 20d2842..b44ec13 100644
--- a/libdwfl/dwfl_module_addrdie.c
+++ b/libdwfl/dwfl_module_addrdie.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwarf_Die *
diff --git a/libdwfl/dwfl_module_addrname.c b/libdwfl/dwfl_module_addrname.c
index 88a8139..3142b3e 100644
--- a/libdwfl/dwfl_module_addrname.c
+++ b/libdwfl/dwfl_module_addrname.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 const char *
diff --git a/libdwfl/dwfl_module_addrsym.c b/libdwfl/dwfl_module_addrsym.c
index 5a7bf71..db302e6 100644
--- a/libdwfl/dwfl_module_addrsym.c
+++ b/libdwfl/dwfl_module_addrsym.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 struct search_state
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
index c9a42ca..6ca9376 100644
--- a/libdwfl/dwfl_module_build_id.c
+++ b/libdwfl/dwfl_module_build_id.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 static int
diff --git a/libdwfl/dwfl_module_dwarf_cfi.c b/libdwfl/dwfl_module_dwarf_cfi.c
index 1dac26d..0e5b435 100644
--- a/libdwfl/dwfl_module_dwarf_cfi.c
+++ b/libdwfl/dwfl_module_dwarf_cfi.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/cfi.h"
 
diff --git a/libdwfl/dwfl_module_eh_cfi.c b/libdwfl/dwfl_module_eh_cfi.c
index dbe43b0..c296e39 100644
--- a/libdwfl/dwfl_module_eh_cfi.c
+++ b/libdwfl/dwfl_module_eh_cfi.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/cfi.h"
 
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index c8b839d..9775ace 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <inttypes.h>
 #include <fcntl.h>
diff --git a/libdwfl/dwfl_module_getelf.c b/libdwfl/dwfl_module_getelf.c
index f20fb04..6358de4 100644
--- a/libdwfl/dwfl_module_getelf.c
+++ b/libdwfl/dwfl_module_getelf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Elf *
diff --git a/libdwfl/dwfl_module_getsrc.c b/libdwfl/dwfl_module_getsrc.c
index f7e340b..fc99b16 100644
--- a/libdwfl/dwfl_module_getsrc.c
+++ b/libdwfl/dwfl_module_getsrc.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 
diff --git a/libdwfl/dwfl_module_getsrc_file.c b/libdwfl/dwfl_module_getsrc_file.c
index 4eaaeaf..cea2ba4 100644
--- a/libdwfl/dwfl_module_getsrc_file.c
+++ b/libdwfl/dwfl_module_getsrc_file.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 
diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c
index 42d2b67..8de9a3e 100644
--- a/libdwfl/dwfl_module_getsym.c
+++ b/libdwfl/dwfl_module_getsym.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 const char *
diff --git a/libdwfl/dwfl_module_info.c b/libdwfl/dwfl_module_info.c
index df16be4..af1faab 100644
--- a/libdwfl/dwfl_module_info.c
+++ b/libdwfl/dwfl_module_info.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 const char *
diff --git a/libdwfl/dwfl_module_nextcu.c b/libdwfl/dwfl_module_nextcu.c
index 6f81f4c..32ee6bc 100644
--- a/libdwfl/dwfl_module_nextcu.c
+++ b/libdwfl/dwfl_module_nextcu.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwarf_Die *
diff --git a/libdwfl/dwfl_module_register_names.c b/libdwfl/dwfl_module_register_names.c
index 18fed37..9ea0937 100644
--- a/libdwfl/dwfl_module_register_names.c
+++ b/libdwfl/dwfl_module_register_names.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 
diff --git a/libdwfl/dwfl_module_report_build_id.c b/libdwfl/dwfl_module_report_build_id.c
index b41512b..31e17c8 100644
--- a/libdwfl/dwfl_module_report_build_id.c
+++ b/libdwfl/dwfl_module_report_build_id.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 // XXX vs report changed module: punting old file
diff --git a/libdwfl/dwfl_module_return_value_location.c b/libdwfl/dwfl_module_return_value_location.c
index 29da61f..ff6f56f 100644
--- a/libdwfl/dwfl_module_return_value_location.c
+++ b/libdwfl/dwfl_module_return_value_location.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 
diff --git a/libdwfl/dwfl_nextcu.c b/libdwfl/dwfl_nextcu.c
index 9ea8388..64bd521 100644
--- a/libdwfl/dwfl_nextcu.c
+++ b/libdwfl/dwfl_nextcu.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwarf_Die *
diff --git a/libdwfl/dwfl_onesrcline.c b/libdwfl/dwfl_onesrcline.c
index 4c20d65..b1e7055 100644
--- a/libdwfl/dwfl_onesrcline.c
+++ b/libdwfl/dwfl_onesrcline.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 Dwfl_Line *
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
index 73a5511..6950a37 100644
--- a/libdwfl/dwfl_report_elf.c
+++ b/libdwfl/dwfl_report_elf.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/libdwfl/dwfl_validate_address.c b/libdwfl/dwfl_validate_address.c
index 7334c3e..15e2602 100644
--- a/libdwfl/dwfl_validate_address.c
+++ b/libdwfl/dwfl_validate_address.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 int
diff --git a/libdwfl/dwfl_version.c b/libdwfl/dwfl_version.c
index d1c5d91..c27d4f6 100644
--- a/libdwfl/dwfl_version.c
+++ b/libdwfl/dwfl_version.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 const char *
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index 80515db..6d5a42a 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <stdio.h>
 #include <fcntl.h>
diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c
index 078e1da..c2c13ba 100644
--- a/libdwfl/gzip.c
+++ b/libdwfl/gzip.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "system.h"
 
diff --git a/libdwfl/image-header.c b/libdwfl/image-header.c
index 62ccc3e..25fbfd9 100644
--- a/libdwfl/image-header.c
+++ b/libdwfl/image-header.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "system.h"
 
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 2a83646..7d5f795 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -29,9 +29,6 @@
 #ifndef _LIBDWFLP_H
 #define _LIBDWFLP_H	1
 
-#ifndef PACKAGE_NAME
-# include <config.h>
-#endif
 #include <libdwfl.h>
 #include <libebl.h>
 #include <assert.h>
diff --git a/libdwfl/lines.c b/libdwfl/lines.c
index 721e29c..128c0c9 100644
--- a/libdwfl/lines.c
+++ b/libdwfl/lines.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include "../libdw/libdwP.h"
 
diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c
index f82ed03..9f05f72 100644
--- a/libdwfl/linux-core-attach.c
+++ b/libdwfl/linux-core-attach.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <fcntl.h>
 #include "system.h"
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 398df96..e6a5c41 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libelfP.h"
 #include "libdwflP.h"
 #include <sys/types.h>
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index 094dd53..c4438c0 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <inttypes.h>
 #include <sys/types.h>
diff --git a/libdwfl/offline.c b/libdwfl/offline.c
index c0a2599..80c80a1 100644
--- a/libdwfl/offline.c
+++ b/libdwfl/offline.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/libdwfl/open.c b/libdwfl/open.c
index 92f2798..4e0461b 100644
--- a/libdwfl/open.c
+++ b/libdwfl/open.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "../libelf/libelfP.h"
 #undef	_
 #include "libdwflP.h"
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index a44126e..1768243 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 typedef uint8_t GElf_Byte;
diff --git a/libdwfl/segment.c b/libdwfl/segment.c
index 2983cf2..d9599a7 100644
--- a/libdwfl/segment.c
+++ b/libdwfl/segment.c
@@ -26,6 +26,10 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "libdwflP.h"
 
 GElf_Addr
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index e32590a..fa768f8 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,9 @@
 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* libelfP.h: Don't include config.h.
+
+2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* elf_begin.c: Use F_GETFD rather than F_GETFL.
 
 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index 4459982..7ee6625 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -30,10 +30,6 @@
 #ifndef _LIBELFP_H
 #define _LIBELFP_H 1
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 #include <ar.h>
 #include <gelf.h>
 
-- 
2.1.4



More information about the Elfutils-devel mailing list