[Scummvm-cvs-logs] scummvm master -> a64b5e2a778333916d6f4b47dc679eba6d34be09

lordhoto lordhoto at gmail.com
Sat Mar 17 20:37:48 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
757fa01a28 COMMON: Add GCC_ATLEAST(major, minor) to simplify testing for versions of GCC.
a64b5e2a77 ALL: Use GCC_ATLEAST().


Commit: 757fa01a28163031a6429189e06e45bfa00a2122
    https://github.com/scummvm/scummvm/commit/757fa01a28163031a6429189e06e45bfa00a2122
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-17T12:09:45-07:00

Commit Message:
COMMON: Add GCC_ATLEAST(major, minor) to simplify testing for versions of GCC.

Changed paths:
    common/scummsys.h



diff --git a/common/scummsys.h b/common/scummsys.h
index 6baab7c..85aaa46 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -23,6 +23,9 @@
 #ifndef COMMON_SCUMMSYS_H
 #define COMMON_SCUMMSYS_H
 
+// This is a convenience macro to test whether the compiler used is a GCC
+// version, which is at least major.minor.
+#define GCC_ATLEAST(major, minor) (defined __GNUC__ && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
 
 #if defined(_WIN32_WCE) && _WIN32_WCE < 300
 	#define NONSTANDARD_PORT


Commit: a64b5e2a778333916d6f4b47dc679eba6d34be09
    https://github.com/scummvm/scummvm/commit/a64b5e2a778333916d6f4b47dc679eba6d34be09
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-17T12:09:49-07:00

Commit Message:
ALL: Use GCC_ATLEAST().

Changed paths:
    common/endian.h
    common/math.h
    common/ptr.h
    common/scummsys.h
    engines/sword25/util/lua/luaconf.h



diff --git a/common/endian.h b/common/endian.h
index 9cb7038..1760dc7 100644
--- a/common/endian.h
+++ b/common/endian.h
@@ -86,7 +86,7 @@
 	}
 
 // Test for GCC >= 4.3.0 as this version added the bswap builtin
-#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#elif GCC_ATLEAST(4, 3)
 
 	FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
 		return __builtin_bswap32(a);
@@ -156,7 +156,7 @@
 //
 // Moreover, we activate this code for GCC >= 3.3 but *only* if unaligned access
 // is allowed.
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3 && !defined(SCUMM_NEED_ALIGNMENT)))
+#if GCC_ATLEAST(4, 0) || (GCC_ATLEAST(3, 3) && !defined(SCUMM_NEED_ALIGNMENT))
 
 	FORCEINLINE uint16 READ_UINT16(const void *ptr) {
 		struct Unaligned16 { uint16 val; } __attribute__ ((__packed__, __may_alias__));
diff --git a/common/math.h b/common/math.h
index f787b84..b85ec0d 100644
--- a/common/math.h
+++ b/common/math.h
@@ -75,7 +75,7 @@ struct Complex {
 	float re, im;
 };
 
-#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#if GCC_ATLEAST(3, 4)
 inline int intLog2(uint32 v) {
 	// This is a slightly optimized implementation of log2 for natural numbers
 	// targeting gcc. It also saves some binary size over our fallback
diff --git a/common/ptr.h b/common/ptr.h
index 2b0670c..725d97e 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -103,7 +103,7 @@ private:
  */
 template<class T>
 class SharedPtr {
-#if !((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95))
+#if !defined __GNUC__ || GCC_ATLEAST(3, 0)
 	template<class T2> friend class SharedPtr;
 #endif
 public:
@@ -200,7 +200,7 @@ public:
 	 * This should just be used for debugging purposes.
 	 */
 	RefValue refCount() const { return _refCount ? *_refCount : 0; }
-#if !((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95))
+#if !defined __GNUC__ || GCC_ATLEAST(3, 0)
 private:
 #endif
 	void decRef() {
diff --git a/common/scummsys.h b/common/scummsys.h
index 85aaa46..9cac664 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -271,7 +271,7 @@
 #ifndef FORCEINLINE
 	#if defined(_MSC_VER)
 		#define FORCEINLINE __forceinline
-	#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+	#elif GCC_ATLEAST(3, 1)
 		#define FORCEINLINE inline __attribute__((__always_inline__))
 	#else
 		#define FORCEINLINE inline
diff --git a/engines/sword25/util/lua/luaconf.h b/engines/sword25/util/lua/luaconf.h
index 38ff9e1..53d0f55 100644
--- a/engines/sword25/util/lua/luaconf.h
+++ b/engines/sword25/util/lua/luaconf.h
@@ -182,8 +182,7 @@
 #define LUAI_FUNC	static
 #define LUAI_DATA	/* empty */
 
-#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
-      defined(__ELF__) && !defined(__PLAYSTATION2__)
+#elif GCC_ATLEAST(3, 2) && defined(__ELF__) && !defined(__PLAYSTATION2__)
 /*
 ** The PS2 gcc compiler doesn't like the visibility attribute, so
 ** we use the normal "extern" definitions in the block below






More information about the Scummvm-git-logs mailing list