1
0
Fork 0

(svn r16492) -Remove: support for gcc2. It hasn't been able to compile OTTD for months. All attempts to do another workaround failed.

release/1.0
smatz 2009-06-01 11:49:46 +00:00
parent bab70a823d
commit c03ce4b1c7
15 changed files with 24 additions and 80 deletions

View File

@ -29,7 +29,6 @@ CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
SORT = !!SORT!! SORT = !!SORT!!
REVISION = !!REVISION!! REVISION = !!REVISION!!
AWK = !!AWK!! AWK = !!AWK!!
GCC295 = !!GCC295!!
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!! CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!! CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!! CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
@ -54,20 +53,6 @@ CFLAGS_MAKEDEP += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SCRIPT_SRC_DIR)
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK) ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
# This 'sed' basicly just removes 'const' from the line if it is a 2+D array
# For more information, please check:
# http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
# http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
GCC295_FIX=sed -r 's@^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$@\1\2 \4\6\8\9@g'
# This 'sed' removes the 3rd '4' in the # lines of the -E output of
# gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
# compiler can't handle that information (just don't ask). So we remove it
# and then it compiles happily and without bitching :)
# Furthermore gcc 2.95 has some trouble with protected and private when
# accessing the protected/private stuff of the enclosing class (or the
# super class of the enclosing class).
GCC295_FIX_2=sed -e 's@\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$@\1@g;s@private:@public:@g;s@protected:@public:@g'
# Check if we want to show what we are doing # Check if we want to show what we are doing
ifdef VERBOSE ifdef VERBOSE
Q = Q =
@ -240,11 +225,7 @@ $(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP) $(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)' $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
ifeq ($(GCC295), 1)
$(Q)$(CXX_HOST) -E $(CFLAGS) $< | $(GCC295_FIX) | $(GCC295_FIX_2) | $(CXX_HOST) $(CFLAGS) -c -o $@ -x c++ -
else
$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $< $(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
endif
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP) $(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)' $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'

View File

@ -1100,35 +1100,24 @@ make_cflags_and_ldflags() {
# Enable some things only for certain GCC versions # Enable some things only for certain GCC versions
cc_version=`$cc_host -dumpversion | cut -c 1,3` cc_version=`$cc_host -dumpversion | cut -c 1,3`
if [ $cc_version -ge 29 ]; then if [ $cc_version -lt 30 ]; then
log 1 "configure: error: gcc older than 3.0 can't compile OpenTTD because of its poor template support"
exit 1
fi
CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
CFLAGS="$CFLAGS -Wno-uninitialized" CFLAGS="$CFLAGS -Wno-uninitialized"
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
fi
gcc295=""
if [ "$cc_version" = 29 ]; then
# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
# need a lovely hack there to make it compile correctly.
gcc295="1"
# Disable warnings about unused variables when
# compiling with asserts disabled
if [ $enable_assert -eq 0 ]; then
CFLAGS="$CFLAGS -Wno-unused"
fi
fi
if [ $cc_version -ge 30 ]; then
CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2"
CFLAGS="$CFLAGS -Wredundant-decls" CFLAGS="$CFLAGS -Wredundant-decls"
# Do not warn about unused variables when building without asserts
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
if [ $enable_assert -eq 0 ]; then if [ $enable_assert -eq 0 ]; then
# Do not warn about unused variables when building without asserts
CFLAGS="$CFLAGS -Wno-unused-variable" CFLAGS="$CFLAGS -Wno-unused-variable"
fi fi
fi
if [ $cc_version -ge 34 ]; then if [ $cc_version -ge 34 ]; then
CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition" CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
@ -2666,7 +2655,6 @@ make_sed() {
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g; s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
s@!!REVISION!!@$revision@g; s@!!REVISION!!@$revision@g;
s@!!AWK!!@$awk@g; s@!!AWK!!@$awk@g;
s@!!GCC295!!@$gcc295@g;
s@!!DISTCC!!@$distcc@g; s@!!DISTCC!!@$distcc@g;
" "

View File

@ -12,7 +12,7 @@ class Blitter_32bppOptimized : public Blitter_32bppSimple {
public: public:
struct SpriteData { struct SpriteData {
uint32 offset[ZOOM_LVL_COUNT][2]; uint32 offset[ZOOM_LVL_COUNT][2];
byte data[VARARRAY_SIZE]; byte data[];
}; };
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom); /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);

View File

@ -12,7 +12,7 @@ class Blitter_8bppOptimized : public Blitter_8bppBase {
public: public:
struct SpriteData { struct SpriteData {
uint32 offset[ZOOM_LVL_COUNT]; ///< offsets (from .data) to streams for different zoom levels uint32 offset[ZOOM_LVL_COUNT]; ///< offsets (from .data) to streams for different zoom levels
byte data[VARARRAY_SIZE]; ///< data, all zoomlevels byte data[]; ///< data, all zoomlevels
}; };
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom); /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);

View File

@ -20,17 +20,9 @@
*/ */
#ifdef NO_DEBUG_MESSAGES #ifdef NO_DEBUG_MESSAGES
#if defined(__GNUC__) && (__GNUC__ < 3)
#define DEBUG(name, level, args...) { }
#else
#define DEBUG(name, level, ...) { } #define DEBUG(name, level, ...) { }
#endif
#else /* NO_DEBUG_MESSAGES */ #else /* NO_DEBUG_MESSAGES */
#if defined(__GNUC__) && (__GNUC__ < 3)
#define DEBUG(name, level, args...) if ((level == 0) || ( _debug_ ## name ## _level >= level)) debug(#name, args)
#else
#define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__) #define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__)
#endif
extern int _debug_ai_level; extern int _debug_ai_level;
extern int _debug_driver_level; extern int _debug_driver_level;

View File

@ -591,7 +591,7 @@ void GamelogGRFAddList(const GRFConfig *newg)
/** List of GRFs using array of pointers instead of linked list */ /** List of GRFs using array of pointers instead of linked list */
struct GRFList { struct GRFList {
uint n; uint n;
const GRFConfig *grf[VARARRAY_SIZE]; const GRFConfig *grf[];
}; };
/** Generates GRFList /** Generates GRFList

View File

@ -80,7 +80,7 @@ public:
public: public:
GRFText *next; GRFText *next;
byte langid; byte langid;
char text[VARARRAY_SIZE]; char text[];
}; };

View File

@ -5,14 +5,6 @@
#ifndef SQUIRREL_CLASS_HPP #ifndef SQUIRREL_CLASS_HPP
#define SQUIRREL_CLASS_HPP #define SQUIRREL_CLASS_HPP
#if (__GNUC__ == 2)
/* GCC 2.95 doesn't like to have SQConvert::DefSQStaticCallback inside a
* template (it gives an internal error 373). Above that, it doesn't listen
* to 'using namespace' inside a function of a template. So for GCC 2.95 we
* do it in the global space to avoid compiler errors. */
using namespace SQConvert;
#endif /* __GNUC__ == 2 */
/** /**
* The template to define classes in Squirrel. It takes care of the creation * The template to define classes in Squirrel. It takes care of the creation
* and calling of such classes, to make the AI Layer cleaner while having a * and calling of such classes, to make the AI Layer cleaner while having a

View File

@ -7,7 +7,7 @@
struct Array { struct Array {
int32 size; int32 size;
int32 array[VARARRAY_SIZE]; int32 array[];
}; };
#endif /* SQUIRREL_HELPER_TYPE_HPP */ #endif /* SQUIRREL_HELPER_TYPE_HPP */

View File

@ -19,8 +19,7 @@ enum {
SIG_GLOB_UPDATE = 64, ///< how many items need to be in _globset to force update SIG_GLOB_UPDATE = 64, ///< how many items need to be in _globset to force update
}; };
/* need to typecast to compile with MorphOS */ assert_compile(SIG_GLOB_UPDATE <= SIG_GLOB_SIZE);
assert_compile((int)SIG_GLOB_UPDATE <= (int)SIG_GLOB_SIZE);
/** incidating trackbits with given enterdir */ /** incidating trackbits with given enterdir */
static const TrackBitsByte _enterdir_to_trackbits[DIAGDIR_END] = { static const TrackBitsByte _enterdir_to_trackbits[DIAGDIR_END] = {

View File

@ -67,7 +67,7 @@ static SpriteCache *AllocateSpriteCache(uint index)
struct MemBlock { struct MemBlock {
size_t size; size_t size;
byte data[VARARRAY_SIZE]; byte data[];
}; };
static uint _sprite_lru_counter; static uint _sprite_lru_counter;

View File

@ -12,7 +12,7 @@ struct Sprite {
uint16 width; uint16 width;
int16 x_offs; int16 x_offs;
int16 y_offs; int16 y_offs;
byte data[VARARRAY_SIZE]; byte data[];
}; };
extern uint _sprite_cache_size; extern uint _sprite_cache_size;

View File

@ -116,9 +116,6 @@
#define printf pspDebugScreenPrintf #define printf pspDebugScreenPrintf
#endif /* PSP */ #endif /* PSP */
/* by default we use [] var arrays */
#define VARARRAY_SIZE
/* Stuff for GCC */ /* Stuff for GCC */
#if defined(__GNUC__) #if defined(__GNUC__)
#define NORETURN __attribute__ ((noreturn)) #define NORETURN __attribute__ ((noreturn))
@ -129,11 +126,6 @@
/* Warn about functions using 'printf' format syntax. First argument determines which parameter /* Warn about functions using 'printf' format syntax. First argument determines which parameter
* is the format string, second argument is start of values passed to printf. */ * is the format string, second argument is start of values passed to printf. */
#define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args))) #define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args)))
#if (__GNUC__ == 2)
#undef VARARRAY_SIZE
#define VARARRAY_SIZE 0
#endif
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#if defined(__WATCOMC__) #if defined(__WATCOMC__)

View File

@ -45,7 +45,7 @@ static char *GetSpecialNameString(char *buff, int ind, int64 *argv, const char *
static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last); static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last);
struct LanguagePack : public LanguagePackHeader { struct LanguagePack : public LanguagePackHeader {
char data[VARARRAY_SIZE]; // list of strings char data[]; // list of strings
}; };
static char **_langpack_offs; static char **_langpack_offs;

View File

@ -1450,7 +1450,7 @@ enum SpriteMasks {
assert_compile( (1 << TRANSPARENT_BIT & SPRITE_MASK) == 0 ); assert_compile( (1 << TRANSPARENT_BIT & SPRITE_MASK) == 0 );
assert_compile( (1 << RECOLOUR_BIT & SPRITE_MASK) == 0 ); assert_compile( (1 << RECOLOUR_BIT & SPRITE_MASK) == 0 );
assert_compile( !(TRANSPARENT_BIT == RECOLOUR_BIT) ); assert_compile( TRANSPARENT_BIT != RECOLOUR_BIT );
assert_compile( (1 << TRANSPARENT_BIT & PALETTE_MASK) == 0); assert_compile( (1 << TRANSPARENT_BIT & PALETTE_MASK) == 0);
assert_compile( (1 << RECOLOUR_BIT & PALETTE_MASK) == 0 ); assert_compile( (1 << RECOLOUR_BIT & PALETTE_MASK) == 0 );