Riki, is this OK?

If this goes in, Kornel will probably have to backport some of his own patches.

JMarc

>From 691f29b4c72cbd98ea7b47bd0d12be9d2235f25f Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Wed, 12 Jun 2019 18:49:29 +0200
Subject: [PATCH 1/2] Avoid warnings with gcc 9

The warning about unneeded std::move can be solved by conditioning on
C++14 mode.

The warnings about deprecated copy is harder, so we disable it for
now. We will be able to fix our part, but Qt triggers it a lot too.

(cherry picked from commit 134f3aedaf4150367cdc2f6855d695d3791a5353)
---
 config/lyxinclude.m4 | 11 +++++++----
 src/MetricsInfo.cpp  |  4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index 2c1a9af12a..1bf9def1c3 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -406,8 +406,11 @@ if test x$GXX = xyes; then
   fi
   dnl Warnings are for preprocessor too
   if test x$enable_warnings = xyes ; then
-      AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra"
-  fi
+      case $gxx_version in
+	  9.*) AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra -Wno-deprecated-copy";;
+	  *) AM_CPPFLAGS="$AM_CPPFLAGS -Wall -Wextra";;
+      esac
+    fi
   case $gxx_version in
       2.*|3.*) AC_ERROR([gcc >= 4.6 is required]);;
       4.0*|4.1*|4.2*|4.3*|4.4*|4.5*) AC_ERROR([gcc >= 4.6 is required]);;
@@ -871,7 +874,7 @@ AC_DEFUN([MSYS_AC_CANONICAL_PATH],
 dnl this is used by the macro blow to general a proper config.h.in entry
 m4_define([LYX_AH_CHECK_DECL],
 [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_$1),
-  [Define if you have the prototype for function `$1'])])
+  [Define if you have the prototype for function `$1'])])dnl`
 
 dnl Check things are declared in headers to avoid errors or warnings.
 dnl Called like LYX_CHECK_DECL(function, header1 header2...)
@@ -891,7 +894,7 @@ done])
 dnl this is used by the macro below to generate a proper config.h.in entry
 m4_define([LYX_AH_CHECK_DEF],
 [AH_TEMPLATE(AS_TR_CPP(HAVE_DEF_$1),
-  [Define to 1 if `$1' is defined in `$2'])])
+  [Define to 1 if `$1' is defined in `$2'])])dnl'
 
 dnl Check whether name is defined in header by using it in codesnippet.
 dnl Called like LYX_CHECK_DEF(name, header, codesnippet)
diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index 60a004573e..7ab62dce11 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -73,7 +73,11 @@ Changer MetricsBase::changeFontSet(string const & name)
 	    && ((isTextFont(oldname) && oldcolor != Color_foreground)
 	        || (isMathFont(oldname) && oldcolor != Color_math)))
 		font.setColor(oldcolor);
+#if __cplusplus >= 201402L
+	return rc;
+#else
 	return move(rc);
+#endif
 }
 
 
-- 
2.20.1

>From 9b9c27a957b5304dbf3eae2406f763bf9313401e Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Wed, 12 Jun 2019 20:17:55 +0200
Subject: [PATCH 2/2] Get full version of gcc

Recent gcc versions return a short version with -dumpversion, e.g. 9.

In this case, use -dumpfullversion, which gives something like 9.1.0.

This makes the gcc 9 detection work properly.

(cherry picked from commit 44bbd0b0ef8450f4d88dfb8c3345118f2fd14dfc)
---
 config/lyxinclude.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index 1bf9def1c3..164b2f7a89 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -383,6 +383,10 @@ if test x$GXX = xyes; then
   if test x$CLANG = xno; then
     dnl Useful for global version info
     gxx_version=`${CXX} -dumpversion`
+    case $gxx_version in
+	*.*) ;;
+	*) gxx_version=`${CXX} -dumpfullversion` ;;
+    esac
     CXX_VERSION="($gxx_version)"
   else
     gxx_version=clang-$clang_version
-- 
2.20.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to