[PATCH] Allow compilation with gcc 2.95
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Mon Aug 19 19:52:15 UTC 2002
Hi!
I need the attached patch to allow compiling using 2.95.3+debian changes
(aka 2.95.4). Running the testsuite I get a couple of extra failures, one
due to out of virtual memory during compilation, one due to an internal
compiler error and a few due to floating point comparison issues, it seems
(no, didnt specify -ffast-math, but not -ffloat-store, too - so those
might be false negatives).
One main point of this patch is to add a check for 2.95 appearantly not
handling default arguments to specialized function templates like the
canonicalCentering<> template. This is plugged to the autoconf framework,
but a classic-way patch can be constructed, too.
Other chunks of the patch deal with missing/improper includes and contain
a rather quick&dirty approach to detecting 2.95 gcc by just checking
__GNUC_MINOR__ == 95 -- anyone with a better idea?
As gcc 2.95 is no longer actively maintained (Mark?) I didnt bother to
file GNAT reports on the C++ language bug, nor the ICE or the excessive
memory use, as all those problems are fixed in 3.0 and 3.2 (didnt check
3.1). But its nice to have the compilation speed of 2.95 during code
development.
No changelog this time, as it doesnt apply to mainline CVS anyway due to
the configure dependency.
Tested by building & testing serial pooma on debian-x86-linux with gcc
2.95.4 and gcc 3.0.4.
Richard.
--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/
-------------- next part --------------
# This is a BitKeeper generated patch for the following project:
# Project Name: pooma/cheetah repository tracking CVS/tarball
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.62 -> 1.63
# r2/src/Tiny/Vector.h 1.2 -> 1.3
# r2/src/Field/FieldCentering.h 1.3 -> 1.4
# r2/scripts/configure.in 1.1 -> 1.2
# r2/src/IO/DiskLayout.h 1.2 -> 1.3
# r2/src/IO/DiskLayout.cmpl.cpp 1.1 -> 1.2
# r2/scripts/acconfig.h 1.1 -> 1.2
# r2/src/Tiny/TinyMatrix.h 1.2 -> 1.3
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/19 richard at mickey.hamnixda.de 1.63
# gcc 2.95 compile fixes, including a new language feature autoconf check
# --------------------------------------------
#
diff --minimal -Nru a/r2/scripts/acconfig.h b/r2/scripts/acconfig.h
--- a/r2/scripts/acconfig.h Mon Aug 19 21:23:49 2002
+++ b/r2/scripts/acconfig.h Mon Aug 19 21:23:49 2002
@@ -5,3 +5,4 @@
#undef POOMA_NO_TEMPLATED_COMPLEX
#undef POOMA_NO_DEPENDENT_TEMPLATE_ARGS
#undef POOMA_NO_PLACEMENT_DELETE
+#undef POOMA_NO_TEMPLATEFUNC_DEFAULTARGS
diff --minimal -Nru a/r2/scripts/configure.in b/r2/scripts/configure.in
--- a/r2/scripts/configure.in Mon Aug 19 21:23:49 2002
+++ b/r2/scripts/configure.in Mon Aug 19 21:23:49 2002
@@ -119,5 +119,26 @@
AC_DEFINE(POOMA_NO_PLACEMENT_DELETE)
])
+dnl
+dnl check for correct handling of default arguments to specialized
+dnl template functions
+dnl
+AC_MSG_CHECKING([wether we handle default args to template functions correct])
+AC_TRY_COMPILE([
+template <int Dim>
+class Centering {};
+template <int Dim>
+const Centering<Dim> test(int a, int b = 0);
+template <>
+const Centering<1> test<1>(int a, int b);
+], [
+ Centering<1> c = test<1>(1);
+], [
+AC_MSG_RESULT([yes])
+] , [
+AC_MSG_RESULT([no])
+AC_DEFINE(POOMA_NO_TEMPLATEFUNC_DEFAULTARGS)
+])
+
AC_OUTPUT()
diff --minimal -Nru a/r2/src/Field/FieldCentering.h b/r2/src/Field/FieldCentering.h
--- a/r2/src/Field/FieldCentering.h Mon Aug 19 21:23:49 2002
+++ b/r2/src/Field/FieldCentering.h Mon Aug 19 21:23:49 2002
@@ -548,11 +548,19 @@
extern const CanonicalCentering<2> canonicalCenteringTwo_g;
extern const CanonicalCentering<3> canonicalCenteringThree_g;
+#if POOMA_NO_TEMPLATEFUNC_DEFAULTARGS
+template <int Dim>
+const Centering<Dim> canonicalCentering
+ (const enum CenteringType type,
+ const enum ContinuityType discontinuous,
+ const int dimension);
+#else
template <int Dim>
const Centering<Dim> canonicalCentering
(const enum CenteringType type,
const enum ContinuityType discontinuous,
const int dimension = 0);
+#endif
template <>
const Centering<1> canonicalCentering<1>
@@ -571,6 +579,16 @@
(const enum CenteringType type,
const enum ContinuityType discontinuous,
const int dimension);
+
+#if POOMA_NO_TEMPLATEFUNC_DEFAULTARGS
+template <int Dim>
+inline const Centering<Dim> canonicalCentering
+ (const enum CenteringType type,
+ const enum ContinuityType discontinuous)
+{
+ return canonicalCentering<Dim>(type, discontinuous, 0);
+}
+#endif
//@}
diff --minimal -Nru a/r2/src/IO/DiskLayout.cmpl.cpp b/r2/src/IO/DiskLayout.cmpl.cpp
--- a/r2/src/IO/DiskLayout.cmpl.cpp Mon Aug 19 21:23:49 2002
+++ b/r2/src/IO/DiskLayout.cmpl.cpp Mon Aug 19 21:23:49 2002
@@ -55,7 +55,7 @@
// Re-check this when GCC 3.0 is ported
-#if defined(__CYGWIN32__)
+#if defined(__CYGWIN32__) || (__GNUC_MINOR__ == 95)
#include <iostream>
#else
#include <ios>
diff --minimal -Nru a/r2/src/IO/DiskLayout.h b/r2/src/IO/DiskLayout.h
--- a/r2/src/IO/DiskLayout.h Mon Aug 19 21:23:49 2002
+++ b/r2/src/IO/DiskLayout.h Mon Aug 19 21:23:49 2002
@@ -60,6 +60,7 @@
#include <fstream> // file I/O
#include <vector> // node lists
+#include <string>
//-----------------------------------------------------------------------------
/** struct DiskNode<Dim>
diff --minimal -Nru a/r2/src/Tiny/TinyMatrix.h b/r2/src/Tiny/TinyMatrix.h
--- a/r2/src/Tiny/TinyMatrix.h Mon Aug 19 21:23:49 2002
+++ b/r2/src/Tiny/TinyMatrix.h Mon Aug 19 21:23:49 2002
@@ -57,7 +57,11 @@
#include "Tiny/TinyMatrixEngine.h"
#include "Tiny/TinyMatrixElements.h"
#include "Tiny/TinyMatrixOperators.h"
+#if defined(__CYGWIN32__) || (__GNUC_MINOR__ == 95)
+#include <iostream>
+#else
#include <ios>
+#endif
//-----------------------------------------------------------------------------
// Forward Declarations:
diff --minimal -Nru a/r2/src/Tiny/Vector.h b/r2/src/Tiny/Vector.h
--- a/r2/src/Tiny/Vector.h Mon Aug 19 21:23:49 2002
+++ b/r2/src/Tiny/Vector.h Mon Aug 19 21:23:49 2002
@@ -57,7 +57,11 @@
#include "Tiny/VectorEngine.h"
#include "Tiny/VectorElements.h"
#include "Tiny/VectorOperators.h"
+#if defined(__CYGWIN32__) || (__GNUC_MINOR__ == 95)
+#include <iostream>
+#else
#include <ios>
+#endif
//-----------------------------------------------------------------------------
// Forward Declarations:
More information about the pooma-dev
mailing list