This patch re-enables support for GCC and clang 3.3 on FreeBSD and OpenBSD.
It tries to retain suppression of warnings as much as possible.


--
Ulrich Wilkens
Email: m...@uwilkens.de

>From 14f7c36de8141e934970c6f86795ad06f9cb5796 Mon Sep 17 00:00:00 2001
From: Ulrich Wilkens <m...@uwilkens.de>
Date: Wed, 27 Jun 2018 03:55:19 +0200
Subject: [PATCH] Reenable gcc support on FreeBSD and OpenBSD

---
 cde/config/cf/FreeBSD.cf      | 32 +++++++++++++++++++++++++++-----
 cde/config/cf/OpenBSD.cf      |  7 ++++++-
 cde/programs/nsgmls/Imakefile | 10 ++++++++--
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/cde/config/cf/FreeBSD.cf b/cde/config/cf/FreeBSD.cf
index e327e3f..32b960c 100644
--- a/cde/config/cf/FreeBSD.cf
+++ b/cde/config/cf/FreeBSD.cf
@@ -179,14 +179,31 @@ USE_GCC = UseGcc
 #endif
 #endif
 
-/* The GCC strength-reduce bug is fixed for FreeBSD 2.1.5 and later */
+/* Suppress warnings dependant from compiler versions */
 #ifndef DefaultGcc2i386Opt
-#if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5)
-#define DefaultGcc2i386Opt -O2 -fno-strict-aliasing -Wno-write-strings \
-        -Wno-unused-result -Wno-deprecated-register
-#endif
+# if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
+#  if (__clang_major__ > 3) || \
+      (__clang_major__ == 3 && __clang_minor__ >= 4)
+#   define DefaultGcc2i386Opt -O2 -fno-strict-aliasing -Wno-write-strings \
+           -Wno-unused-result -Wno-deprecated-register
+#  else
+#   define DefaultGcc2i386Opt -O2 -fno-strict-aliasing -Wno-write-strings \
+           -Wno-unused-result
+#  endif
+# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
+#  if (__GNUC__ > 4) || \
+      (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+#   define DefaultGcc2i386Opt -O2 -fno-strict-aliasing -Wno-write-strings \
+           -Wno-unused-result -Wno-deprecated
+#  else
+#   define DefaultGcc2i386Opt -O2 -fno-strict-aliasing -Wno-write-strings
+#  endif
+# else
+#   define DefaultGcc2i386Opt -O2 -fno-strict-aliasing
+# endif
 #endif
 
+
 #ifndef OptimizedCDebugFlags
 # if defined(i386Architecture) || defined(AMD64Architecture)
 #  define OptimizedCDebugFlags DefaultGcc2i386Opt
@@ -210,6 +227,11 @@ ICONVSYSLIB != if test -f /usr/local/include/iconv.h; then echo -liconv; else ec
 
 #define StandardDefines		-DCSRG_BASED
 #define StandardIncludes	-I/usr/local/include
+
+#ifndef TopMotifInclude
+#define TopMotifInclude		/usr/local/include
+#endif
+
 #define BuildLibPathVar		LD_LIBRARY_PATH
 
 #define DefaultUserPath		/bin:/usr/bin:/usr/local/bin:$(BINDIR)
diff --git a/cde/config/cf/OpenBSD.cf b/cde/config/cf/OpenBSD.cf
index add7c29..7ceb358 100644
--- a/cde/config/cf/OpenBSD.cf
+++ b/cde/config/cf/OpenBSD.cf
@@ -1050,8 +1050,13 @@ CXXDEPENDINCLUDE != CcCmd -v -x c++ /dev/null -fsyntax-only \
 # endif
 #endif
 
+/* Suppress warnings dependant from compiler versions */
 #if !defined(GccWarningOptions)
-# define GccWarningOptions 		-Wpointer-arith -Wno-unused -Wno-write-strings -Wno-switch -Wno-unused-result -Wno-deprecated-register
+# if (defined __clang__)
+#  define GccWarningOptions 	-Wpointer-arith -Wno-unused -Wno-write-strings -Wno-switch -Wno-unused-result -Wno-deprecated-register
+# else
+#  define GccWarningOptions 	-Wpointer-arith -Wno-unused -Wno-write-strings -Wno-switch
+# endif
 #endif
 
 #define TtClientLibs $(TTLIB) $(XTOOLLIB) $(XLIB)
diff --git a/cde/programs/nsgmls/Imakefile b/cde/programs/nsgmls/Imakefile
index c108446..5d35276 100644
--- a/cde/programs/nsgmls/Imakefile
+++ b/cde/programs/nsgmls/Imakefile
@@ -62,6 +62,12 @@ M4 = /bin/m4
 
 #if defined(LinuxArchitecture) || defined(BSDArchitecture)
 
+#if defined(__llvm__)
+NOIMPLTEMPLATES =
+#else
+NOIMPLTEMPLATES = -fno-implicit-templates
+#endif
+
 /*
  * put cpp directives here rather than in CXXDEFINES because
  * for some reason the CXXDEFINES aren't passed to the link phase
@@ -69,12 +75,12 @@ M4 = /bin/m4
  */
 CXXOPTIONS = \
   -DSP_VOLATILE=volatile -DSP_CONST=const -DSP_ANSI_CLASS_INST \
-  -DSP_HAVE_LOCALE -DSP_MULTI_BYTE -DSP_MANUAL_INST -fno-implicit-templates
+  -DSP_HAVE_LOCALE -DSP_MULTI_BYTE -DSP_MANUAL_INST $(NOIMPLTEMPLATES)
 
 /*
  * Flags passed into compile step when doing manual template instantiation.
  */
-CXXTEMPLATEFLAGS = -fno-implicit-templates
+CXXTEMPLATEFLAGS = $(NOIMPLTEMPLATES)
 
 M4 = /usr/bin/m4
 
-- 
1.7.11.5

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to