Fix gcc2 build on Mac OS X Lion.

The gcc2 cross-compiler built on Mac OS X Lion has a bug in it
where it is erroring with 'cast specifies signature type' when
assigning 0 or NULL to a pointer to a member fuction. NULL in this
instance is correctly converted to 0 since it is illegal to assign
((void*)0) to a pointer to a member function. However, it should
be legal to assign 0 to a pointer to a member function. Thus, there
is a bug.  Since I can't fix the gcc2 compiler I am working around
this bug by assigning the pointer to a do nothing function instead.

My host compiler version is
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

The same error occurs using the default gcc-llvm compiler and
a standard gcc 4.61 built from source. This bug does not occur on
Mac OS X 10.6 gcc2 or gcc4, nor does it occur on Mac OS X 10.7 with
the gcc4 cross-compiler.

If and when we decide to finally leave gcc2 behind we can revert this
change.
This commit is contained in:
John Scipione
2012-04-07 06:21:26 -04:00
parent 7d0f6bd08c
commit 7c369a4b3f
4 changed files with 32 additions and 16 deletions
+8
View File
@@ -102,6 +102,14 @@ protected:
void SetupErrorBuffer(int x, int y, int width);
void DitherFloydSteinberg(uchar* destination,
const uchar* source, int x, int y, int width);
// Do nothing method to get around a bug in
// the gcc2 cross-compiler built on Mac OS X
// Lion where a compiler error occurs when
// assigning a member function pointer to NULL
// or 0: cast specifies signature type.
// However, this should be legal according to
// the C++03 standard.
void DitherNone(uchar*, const uchar*, int, int, int) {};
private:
enum {