|
From: <bul...@us...> - 2013-06-08 22:24:18
|
Revision: 22799
http://sourceforge.net/p/bzflag/code/22799
Author: bullet_catcher
Date: 2013-06-08 22:24:15 +0000 (Sat, 08 Jun 2013)
Log Message:
-----------
Remove configure check for unused std::wstring type.
Add check for std::shared_ptr type.
Include support for fallback to std::tr1::shared_ptr for Apple LLVM (command line) compiler.
Use the same set of compiler warnings for Linux and Mac OS X command line tools.
Do not use GCC's -fexpensive-optimizations flag with Apple LLVM compiler.
Modified Paths:
--------------
trunk/bzflag/Xcode/config.h
trunk/bzflag/configure.ac
trunk/bzflag/src/bzfs/ShotManager.h
Modified: trunk/bzflag/Xcode/config.h
===================================================================
--- trunk/bzflag/Xcode/config.h 2013-06-08 17:56:40 UTC (rev 22798)
+++ trunk/bzflag/Xcode/config.h 2013-06-08 22:24:15 UTC (rev 22799)
@@ -183,9 +183,6 @@
/* Define to 1 if you have a conforming std::min */
#define HAVE_STD__MIN 1
-/* Define to 1 if the system has the type `std::wstring'. */
-#define HAVE_STD__WSTRING 1
-
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
Modified: trunk/bzflag/configure.ac
===================================================================
--- trunk/bzflag/configure.ac 2013-06-08 17:56:40 UTC (rev 22798)
+++ trunk/bzflag/configure.ac 2013-06-08 22:24:15 UTC (rev 22799)
@@ -453,7 +453,13 @@
esac
AC_LANG(C++)
-AC_CHECK_TYPES([std::wstring],,,[#include <iostream>])
+AC_CHECK_TYPES([std::shared_ptr<int>],
+ [# BZFlag expects std::shared_ptr support by default],
+ [AC_CHECK_TYPES([[std::tr1::shared_ptr<int>]],
+ AC_DEFINE([[USE_TR1]], [[1]], [Define to 1 to use C++0X TR1]),
+ AC_MSG_ERROR([[The C++11 std::shared_ptr type is required to build BZFlag]]),
+ [[#include <tr1/memory>]])],
+ [#include <memory>])
ac_cv_search_glBegin=no
ac_cv_search_gluScaleImage=no
@@ -680,10 +686,13 @@
# FIXME: these checks below are not compiler characteristics other
# than the FLAGS they set.
+#
+# the GCC version is known to be at least 4.3 because it has C++0x support
+# possible future warnings: -Wconversion -Wfloat-equal -Wpointer-arith -Wredundant-decls -Wwrite-strings
+FLAGS="-Wall -Wextra -Wcast-qual -Wshadow -Wundef"
case $host_os in
linux*)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
- FLAGS="-Wall -Wextra -Wcast-qual -Wshadow -Wundef" # -Wconversion -Wfloat-equal -Wpointer-arith -Wredundant-decls -Wwrite-strings
CONF_CFLAGS="$CONF_CFLAGS $FLAGS"
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS -pedantic"
case $host_vendor in
@@ -728,7 +737,6 @@
AC_DEFINE(ETC_INET, [], [hosts is in /etc/inet/])
AC_DEFINE(SUN_OGL_NO_VERTEX_MACROS, [], [Sun OpenGL No Macro Vertex]);;
macos|darwin*)
- FLAGS="-pipe -Wno-long-long -W -Wall -Wundef -Wno-import"
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS -pedantic";;
irix)
@@ -764,9 +772,16 @@
AC_DEFINE(DEBUG, 1, [Debugging enabled])
else
if test "$GCC" = yes ; then
- OPTIMIZE="-fexpensive-optimizations"
- CONF_CFLAGS="$CONF_CFLAGS $OPTIMIZE"
- CONF_CXXFLAGS="$CONF_CXXFLAGS $OPTIMIZE"
+ case "`$CC --version 2>&1`" in
+ *LLVM*)
+ # Apple LLVM falsely claims to be GCC
+ ;;
+ *)
+ OPTIMIZE="-fexpensive-optimizations"
+ CONF_CFLAGS="$CONF_CFLAGS $OPTIMIZE"
+ CONF_CXXFLAGS="$CONF_CXXFLAGS $OPTIMIZE"
+ ;;
+ esac
fi
AC_DEFINE(NDEBUG, 1, [Debugging disabled])
fi
Modified: trunk/bzflag/src/bzfs/ShotManager.h
===================================================================
--- trunk/bzflag/src/bzfs/ShotManager.h 2013-06-08 17:56:40 UTC (rev 22798)
+++ trunk/bzflag/src/bzfs/ShotManager.h 2013-06-08 22:24:15 UTC (rev 22799)
@@ -23,8 +23,15 @@
#include <string>
#include <vector>
#include <map>
+#ifdef USE_TR1
+#include <tr1/memory>
+#include <tr1/functional>
+#define shared_ptr tr1::shared_ptr
+#define function tr1::function
+#else
#include <memory>
#include <functional>
+#endif
/** a ShotManager is used track shots fired by players and the server
*/
@@ -99,6 +106,12 @@
typedef std::vector<std::shared_ptr<Shot>> ShotList;
typedef std::shared_ptr<std::function <void (Shot&)> > ShotEvent;
+#ifdef USE_TR1
+// limit the scope of possible side effects of these macro definitions
+#undef shared_ptr
+#undef function
+#endif
+
#define INVALID_SHOT_GUID 0
class Manager
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|