Skip to content

Commit

Permalink
Emit a warning at compile time about C++ API being unstable
Browse files Browse the repository at this point in the history
Aware users can remove the warning by defining macro
USE_UNSTABLE_GEOS_CPP_API

See discussion
https://lists.osgeo.org/pipermail/geos-devel/2017-October/008054.html
  • Loading branch information
strk committed Oct 7, 2017
1 parent 3818e56 commit aae3658
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion configure.ac
Expand Up @@ -39,6 +39,10 @@ AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([include/config.h] [include/geos/platform.h])
AC_PROG_CC


dnl Hush warnings
AC_DEFINE(USE_UNSTABLE_GEOS_CPP_API, [1], [We know])

dnl use libtool ----------------------------------------------------------
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
Expand Down Expand Up @@ -162,7 +166,8 @@ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_wno
NUMERICFLAGS=""
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])

DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
HUSHWARNING="-DUSE_UNSTABLE_GEOS_CPP_API"
DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS} ${HUSHWARNING}"

AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
Expand Down
5 changes: 5 additions & 0 deletions include/geos/geom/Geometry.h
Expand Up @@ -21,6 +21,11 @@
#ifndef GEOS_GEOM_GEOMETRY_H
#define GEOS_GEOM_GEOMETRY_H

#ifndef USE_UNSTABLE_GEOS_CPP_API
# warning "The GEOS C++ API is unstable, please use the C API instead"
# warning "HINT: #include geos_c.h"
#endif

#include <geos/export.h>
#include <geos/platform.h>
#include <geos/inline.h>
Expand Down
4 changes: 0 additions & 4 deletions tests/xmltester/Makefile.am
Expand Up @@ -136,10 +136,6 @@ XMLTester_SOURCES = \

XMLTester_LDADD = $(LIBS)

# Intentionally drop -ansi -pedantic
# See http://trac.osgeo.org/geos/ticket/319
XMLTester_CXXFLAGS = $(INLINE_FLAGS)

AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CPPFLAGS += -I$(top_srcdir)/src/io/tinyxml -DTIXML_USE_STL

Expand Down

0 comments on commit aae3658

Please sign in to comment.