summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--libgphoto2/gphoto2-abilities-list.c2
-rw-r--r--libgphoto2_port/configure.ac2
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c2
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-log.c2
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2/gphoto2-port-log.h10
-rw-r--r--packaging/generic/print-camera-list.c3
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/ddb/ddb-common.h2
-rw-r--r--tests/ddb/ddb-txt.y1
-rw-r--r--tests/ddb/test-ddb.c1
-rw-r--r--tests/test-pedantic-compilation.cxx9
12 files changed, 15 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac
index 785059dee..6240c6223 100644
--- a/configure.ac
+++ b/configure.ac
@@ -520,6 +520,8 @@ if test "x$GCC" = "xyes"; then
fi
AM_CONDITIONAL([HAVE_GCC], [test "x$GCC" = "xyes"])
+AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE"
+
dnl FIXME: Is this accurate?
AM_CONDITIONAL([HAVE_CXX], [test -n "$CXX" && test "X$CXX" != "Xno"])
diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c
index 9db2eb9b5..fab1cd38d 100644
--- a/libgphoto2/gphoto2-abilities-list.c
+++ b/libgphoto2/gphoto2-abilities-list.c
@@ -22,8 +22,6 @@
* Boston, MA 02111-1307, USA.
*/
-#define _GPHOTO2_INTERNAL_CODE
-
#include "config.h"
#include <gphoto2/gphoto2-abilities-list.h>
diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac
index dea20abf8..1ffe98bbe 100644
--- a/libgphoto2_port/configure.ac
+++ b/libgphoto2_port/configure.ac
@@ -388,6 +388,8 @@ if test "$GCC" = "yes"; then
AM_LDFLAGS="$AM_LDFLAGS -g"
fi
+AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE"
+
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
index 3764c424f..e71b67408 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
@@ -18,8 +18,6 @@
* Boston, MA 02111-1307, USA.
*/
-#define _GPHOTO2_INTERNAL_CODE
-
#include "config.h"
#include <gphoto2/gphoto2-port-info-list.h>
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
index 22f2db75d..2096d451b 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-log.c
@@ -18,8 +18,6 @@
* Boston, MA 02111-1307, USA.
*/
-#define _GPHOTO2_INTERNAL_CODE
-
#include "config.h"
#include <gphoto2/gphoto2-port-log.h>
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2/gphoto2-port-log.h b/libgphoto2_port/libgphoto2_port/gphoto2/gphoto2-port-log.h
index 2e554015c..ddf79e0b1 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2/gphoto2-port-log.h
+++ b/libgphoto2_port/libgphoto2_port/gphoto2/gphoto2-port-log.h
@@ -80,11 +80,8 @@ void gp_log_data (const char *domain, const char *data, unsigned int size);
* mymod before using #GP_DEBUG().
**/
-#ifdef GP_DEBUG
-/* GP_DEBUG has already been defined.
- * That case has only one purpose: Cheating for the -pedantic C++ check.
- */
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#ifdef _GPHOTO2_INTERNAL_CODE
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define GP_DEBUG(...) \
gp_log(GP_LOG_DEBUG, GP_MODULE "/" __FILE__, __VA_ARGS__)
#elif defined(__GNUC__)
@@ -96,6 +93,7 @@ void gp_log_data (const char *domain, const char *data, unsigned int size);
# endif
#define GP_DEBUG (void)
#endif
+#endif /* _GPHOTO2_INTERNAL_CODE */
#else /* DISABLE_DEBUGGING */
@@ -106,6 +104,7 @@ void gp_log_data (const char *domain, const char *data, unsigned int size);
#define gp_logv(level, domain, format, args) /**/
#define gp_log_data(domain, data, size) /**/
+#ifdef _GPHOTO2_INTERNAL_CODE
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define GP_DEBUG(...) /* no-op */
#elif defined(__GNUC__)
@@ -113,6 +112,7 @@ void gp_log_data (const char *domain, const char *data, unsigned int size);
#else
#define GP_DEBUG (void)
#endif
+#endif /* _GPHOTO2_INTERNAL_CODE */
#endif /* DISABLE_DEBUGGING */
diff --git a/packaging/generic/print-camera-list.c b/packaging/generic/print-camera-list.c
index ae56c5589..9822f6c0d 100644
--- a/packaging/generic/print-camera-list.c
+++ b/packaging/generic/print-camera-list.c
@@ -21,9 +21,6 @@
*/
-#define _GPHOTO2_INTERNAL_CODE
-
-
#define GP_USB_HOTPLUG_SCRIPT "usbcam"
/* Not sure whether this is the best possible name */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 70df7b9e3..8ea93c4d7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -54,6 +54,9 @@ PEDANTIC_CXXFLAGS =
endif
test_pedantic_c_SOURCES = test-pedantic-compilation.c
+test_pedantic_c_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(CPPFLAGS) \
+ -U _GPHOTO2_INTERNAL_CODE
test_pedantic_c_CFLAGS = $(PEDANTIC_CFLAGS) $(AM_CFLAGS) $(CFLAGS)
test_pedantic_c_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
@@ -62,6 +65,9 @@ test_pedantic_c_LDADD = \
$(INTLLIBS)
test_pedantic_cxx_SOURCES = test-pedantic-compilation.cxx
+test_pedantic_cxx_CPPFLAGS = \
+ $(AM_CPPFLAGS) $(CPPFLAGS) \
+ -U _GPHOTO2_INTERNAL_CODE
test_pedantic_cxx_CXXFLAGS = $(PEDANTIC_CXXFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
test_pedantic_cxx_LDADD = \
$(top_builddir)/libgphoto2/libgphoto2.la \
diff --git a/tests/ddb/ddb-common.h b/tests/ddb/ddb-common.h
index 383a526ef..43905f8b4 100644
--- a/tests/ddb/ddb-common.h
+++ b/tests/ddb/ddb-common.h
@@ -23,8 +23,6 @@
#ifndef __DDB_TXT_H__
#define __DDB_TXT_H__
-#define _GPHOTO2_INTERNAL_CODE
-
#include <stdio.h>
#include <gphoto2/gphoto2-abilities-list.h>
diff --git a/tests/ddb/ddb-txt.y b/tests/ddb/ddb-txt.y
index 1596827e9..85629f60e 100644
--- a/tests/ddb/ddb-txt.y
+++ b/tests/ddb/ddb-txt.y
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
-#define _GPHOTO2_INTERNAL_CODE
#include <gphoto2/gphoto2-abilities-list.h>
#include "ddb-common.h"
diff --git a/tests/ddb/test-ddb.c b/tests/ddb/test-ddb.c
index 17e529fbf..b07caa629 100644
--- a/tests/ddb/test-ddb.c
+++ b/tests/ddb/test-ddb.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>
-#define _GPHOTO2_INTERNAL_CODE
#include <gphoto2/gphoto2-abilities-list.h>
#include "ddb-common.h"
diff --git a/tests/test-pedantic-compilation.cxx b/tests/test-pedantic-compilation.cxx
index 0b501f9b8..92898219a 100644
--- a/tests/test-pedantic-compilation.cxx
+++ b/tests/test-pedantic-compilation.cxx
@@ -1,12 +1,3 @@
-/* Defining GP_DEBUG before including gphoto2-port-log.h prevents the
- * latter from defining GP_DEBUG as a variadic macro. Variadic macros
- * have not been defined in ANSI C, so we are cheating here.
- *
- * This should be the only problem we cause, and thus work around it
- * here.
- */
-#define GP_DEBUG
-
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-list.h>