For much of our history, until fairly recently, the versions of gcc that
we used defaulted to -std=gnu++98 when compiiling C++ code.

When FreeBSD on i386 and amd64 switched from gcc to clang, it also
defaulted to -std=gnu++98.  Clang has been C++11 compliant from version
3.3 onwards.  Around the time of the switch, I added the
-DHAVE_STL_INCLUDE_PATH compiler flag so that clang would use it's own
STL include files instead of the boost TR1 includes.  Clang was
perfectly happy using its own STL include files even though they were
not part of C++98, only C++11.

Later on, when clang 6 changed the default to gnu++14, the build
generated tons warning and some number of errors.  To work around this,
I added the -std=gnu++98 compiler flag to force the old mode.

FreeBSD on powerpc still uses gcc and it recently came to my attention
that the build was broken there.  The FreeBSD port of AOO to powerpc
does not use -DHAVE_STL_INCLUDE_PATH, so it was falling back to the
boost TR1 headers.  The FreeBSD port uses the system boost, and recent
versions of boost have dropped TR1 support.  To work around that, I
tried enabling -DHAVE_STL_INCLUDE_PATH to use the gcc C++ headers.  This
failed badly because the gcc STL headers check to see if the compilation
mode is C++11 or better and immediately error out of this is not the
case.  Switching the compilation mode to c++11 results in the warning
and error spew mentioned above.  I tried modifying the stlport headers
to include the gcc TR1 headers in gnu++98 mode.  That worked better, but
I still got some mysterious C++ errors that I was not able to figure
out.  My next attempt will be to try the boost non-TR1 headers.

Turning to Linux as a stepping stone, I've notice the build warning
spewage on recent Linux distributions, such as Debian 9, that have newer
versions of gcc.  By using the patch below, I was able to reduce the
size of the build log for trunk from 1354815 lines to 359998 lines.  I
think the extra compiler defines are required because the compiler
detection code in our bundled version of boost is too old to figure out
what to do with new gcc in gnu++98 mode.

One of the largest contributors to the warnings is std::auto_ptr.  This
is deprecated in C++11 and is totally removed in C++17.  The new way is
to use std::unique_ptr, but that wasn't available before C++11.  We
can't fix our code for this until we are totally off the old toolchains,
which means after we have abandoned CentOS 6 and earlier as well as
Visual Studio earlier than 2015.

Once our code has been converted to C++11, then I think we might be able
to deorbit the boost and stlport modules and just use the compiler
includes directly.

diff --git a/main/solenv/gbuild/platform/linux.mk 
b/main/solenv/gbuild/platform/linux.mk
index 3f35f2a3ce..0ffaf1a84f 100644
--- a/main/solenv/gbuild/platform/linux.mk
+++ b/main/solenv/gbuild/platform/linux.mk
@@ -89,6 +89,10 @@ gb_CXXFLAGS := \
        -fuse-cxa-atexit \
        -fvisibility-inlines-hidden \
        -fvisibility=hidden \
+       -std=gnu++98 \
+       -DBOOST_NO_CXX11_VARIADIC_TEMPLATES \
+       -DBOOST_NO_CXX11_RVALUE_REFERENCES \
+       -DBOOST_NO_CXX11_STATIC_ASSERT \
        -pipe \
 
 ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
diff --git a/main/solenv/inc/unxlng.mk b/main/solenv/inc/unxlng.mk
index afaa50a0e5..060ee5976c 100644
--- a/main/solenv/inc/unxlng.mk
+++ b/main/solenv/inc/unxlng.mk
@@ -77,7 +77,7 @@ CFLAGSENABLESYMBOLS=-g # was temporarily commented out, 
reenabled before Beta
 .ENDIF
 
 # flags for the C++ Compiler
-CFLAGSCC= -pipe $(ARCH_FLAGS)
+CFLAGSCC= -pipe $(ARCH_FLAGS) -std=gnu++98 -DBOOST_NO_CXX11_VARIADIC_TEMPLATES 
-DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_NO_CXX11_STATIC_ASSERT
 # Flags for enabling exception handling
 .IF "$(COM)"=="CLANG"
 CFLAGSEXCEPTIONS=-fexceptions


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to