Opened 7 years ago
Closed 6 years ago
#7066 closed task (fixed)
Implement RFC68: C++11
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | ConfigBuild | Version: | svn-trunk |
Severity: | normal | Keywords: | c++11 c++14 |
Cc: | Mateusz Łoskot |
Description
A place for discussion of implementing RFC 68: C++11 Compilation Mode.
Change History (7)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Cc: | added |
---|
comment:3 by , 7 years ago
Here is what mloskot did with GEOS:
- https://github.com/OSGeo/geos/commit/1e2b2a2600c4ee31378842cc3c46d61cfad9efce
- https://github.com/OSGeo/geos/commit/4c9b08743a31f3ecf3fee742cbaffcb69e00d2f7
configure.{ac,in}:
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
Or via trac:
- https://trac.osgeo.org/geos/changeset/6932138816c720c5b90dd7490541274e40fb50f1/git
- https://trac.osgeo.org/geos/changeset/4c9b08743a31f3ecf3fee742cbaffcb69e00d2f7/git
- https://trac.osgeo.org/geos/changeset/b507095ff861fbe8642cd65660bf530e674efb2f/git
- https://trac.osgeo.org/geos/changeset/1e2b2a2600c4ee31378842cc3c46d61cfad9efce/git
unique_ptr:
comment:4 by , 7 years ago
Kurt, FYI, my Autoconf is a bit rusty, so those changes in GEOS might not be optimal.
comment:5 by , 7 years ago
2nd attempt still has issues, but it feels like it is on track. Need to figure out how to get python to use the correct compile flag.
https://github.com/OSGeo/gdal/pull/243/commits/9c2fa9b7939defa237c57ff0dde56f59fc98e7ed
Created a pull request to start testing with travis to see where things are at. I bet all the builds will fail. Most failed pretty quickly
trusty_clang:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace using ::gets; ~~^
mingw mingw64 python3 android:
configure: error: *** A compiler with support for C++11 language features is required.
bigendian:
In file included from gdalallregister.cpp:30:0: /home/travis/build/OSGeo/gdal/gdal/gcore/gdal_priv.h:532:21: error: 'virtual char** GDALDataset::GetMetadata(const char*)' can be marked override [-Werror=suggest-override] virtual char ** GetMetadata(const char * pszDomain = "") CPL_OVERRIDE;
gcc48_stdcpp11
gcc52_stdcpp14
precise32
comment:6 by , 7 years ago
trusty clang:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace using ::gets; ~~^
https://stackoverflow.com/questions/24342312/clang-seems-to-use-the-gcc-libraries
You need to install libc++ and make clang use it with -stdlib=libc++
comment:7 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
C++11 requirement and related changes now committed in trunk
I didn't like this first thing I tried. I started with just trying to remove the
--with_cpp11
flag. I think it will be better to change--with_cpp11
to--with_cpp14
and have the default case enforce C++11.To enforce C++11 (and also allow C++14), I'll add an
#if
in cpl_port.h that does a#error
if__cplusplus
is less than201103
.I am planning to test this a pull requests so that we can work through the travis-ci builds. I will also attempt the windows builds, but I could use help.
gdal/configure.ac
__cplusplus >= 201103L &&( (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))) || ((defined(__GNUC__) && __GNUC__ >= 7)) ) )LOC_MSG([ C++11 support: ${CXX11_SUPPORT}])