summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-07 01:03:42 +0200
committerMarcus Meissner <meissner@suse.de>2021-10-11 09:20:50 +0200
commit767ee8bad421f7317718a1c6f138fb32d8432a7c (patch)
treeed207bdcbdea3ff25d405559034838121022d6e8 /tests
parent6e2779554662e37a1e53570e590c818ad99a96d9 (diff)
downloadlibgphoto2-767ee8bad421f7317718a1c6f138fb32d8432a7c.tar.gz
Avoid accidental include file name collisions
There are five libgphoto2 internal *.h include files inside the source tree's `libgphoto2/` folder. Internal means they are part of the libgphoto2 implementation, and are not part of the public libgphoto2 API or ABI. These files have names which are so generic that it is difficult to see from a `#include` statement that the included file is actually part of libgphoto2: bayer-types.h bayer.h exif.h gamma.h jpeg.h While building, an additional file is created inside the `libgphoto2/` folder with a name which does hint to its relationship with libgphoto2: gphoto2-endian.h To reduce the probability of accidental conflicts with include files which might also be called the same very generic name, this changes the use of these include files to a preprocessor directive like #include "libgphoto2/bayer.h> instead of #include "bayer.h" To enforce the need for the "libgphoto2/" part in the #include preprocessor directive, this also removes the respective `-I` arguments for the `libgphoto2` subdir (both in source tree and in build tree) from `*_CPPFLAGS`. This change was inspired by `libgphoto2/` and `camlibs/stv0680/` containing very different include files both called `bayer.h`.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/test-endian.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cbbe9523f..fdccf9a40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,7 +30,7 @@ INSTALL_TESTS_ENVIRONMENT = env \
# Default CPPFLAGS to use
-AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/libgphoto2_port -I$(top_srcdir)/libgphoto2 -I$(top_builddir)/libgphoto2
+AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/libgphoto2_port
# Test endianness conversions
diff --git a/tests/test-endian.c b/tests/test-endian.c
index 53c06d2b7..5c42d0718 100644
--- a/tests/test-endian.c
+++ b/tests/test-endian.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <stdlib.h>
-#include <gphoto2-endian.h>
+#include <libgphoto2/gphoto2-endian.h>
#include <gphoto2/gphoto2-filesys.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>