diff options
-rw-r--r-- | Makefile.src.in | 19 | ||||
-rw-r--r-- | config.lib | 36 | ||||
-rw-r--r-- | src/blitter/32bpp_optimized.hpp | 2 | ||||
-rw-r--r-- | src/blitter/8bpp_optimized.hpp | 2 | ||||
-rw-r--r-- | src/debug.h | 12 | ||||
-rw-r--r-- | src/gamelog.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_text.cpp | 2 | ||||
-rw-r--r-- | src/script/squirrel_class.hpp | 8 | ||||
-rw-r--r-- | src/script/squirrel_helper_type.hpp | 2 | ||||
-rw-r--r-- | src/signal.cpp | 3 | ||||
-rw-r--r-- | src/spritecache.cpp | 2 | ||||
-rw-r--r-- | src/spritecache.h | 2 | ||||
-rw-r--r-- | src/stdafx.h | 8 | ||||
-rw-r--r-- | src/strings.cpp | 2 | ||||
-rw-r--r-- | src/table/sprites.h | 2 |
15 files changed, 24 insertions, 80 deletions
diff --git a/Makefile.src.in b/Makefile.src.in index 55232fafd..044aea3a6 100644 --- a/Makefile.src.in +++ b/Makefile.src.in @@ -29,7 +29,6 @@ CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!! SORT = !!SORT!! REVISION = !!REVISION!! AWK = !!AWK!! -GCC295 = !!GCC295!! CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!! CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!! 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) -# 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 ifdef VERBOSE 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) $(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 $@ $< -endif $(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP) $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)' diff --git a/config.lib b/config.lib index 78d328903..313061396 100644 --- a/config.lib +++ b/config.lib @@ -1100,34 +1100,23 @@ make_cflags_and_ldflags() { # Enable some things only for certain GCC versions cc_version=`$cc_host -dumpversion | cut -c 1,3` - if [ $cc_version -ge 29 ]; then - CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" - CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" - CFLAGS="$CFLAGS -Wno-uninitialized" - - CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" + 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 - 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" + CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" + CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" + CFLAGS="$CFLAGS -Wno-uninitialized" - # Disable warnings about unused variables when - # compiling with asserts disabled - if [ $enable_assert -eq 0 ]; then - CFLAGS="$CFLAGS -Wno-unused" - fi - fi + CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" + CFLAGS="$CFLAGS -Wredundant-decls" + + CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" - if [ $cc_version -ge 30 ]; then - CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" - CFLAGS="$CFLAGS -Wredundant-decls" + if [ $enable_assert -eq 0 ]; then # Do not warn about unused variables when building without asserts - if [ $enable_assert -eq 0 ]; then - CFLAGS="$CFLAGS -Wno-unused-variable" - fi + CFLAGS="$CFLAGS -Wno-unused-variable" fi if [ $cc_version -ge 34 ]; then @@ -2666,7 +2655,6 @@ make_sed() { s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g; s@!!REVISION!!@$revision@g; s@!!AWK!!@$awk@g; - s@!!GCC295!!@$gcc295@g; s@!!DISTCC!!@$distcc@g; " diff --git a/src/blitter/32bpp_optimized.hpp b/src/blitter/32bpp_optimized.hpp index c8b994d9c..344659c85 100644 --- a/src/blitter/32bpp_optimized.hpp +++ b/src/blitter/32bpp_optimized.hpp @@ -12,7 +12,7 @@ class Blitter_32bppOptimized : public Blitter_32bppSimple { public: struct SpriteData { uint32 offset[ZOOM_LVL_COUNT][2]; - byte data[VARARRAY_SIZE]; + byte data[]; }; /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom); diff --git a/src/blitter/8bpp_optimized.hpp b/src/blitter/8bpp_optimized.hpp index 85a7b06ad..a7c8ea186 100644 --- a/src/blitter/8bpp_optimized.hpp +++ b/src/blitter/8bpp_optimized.hpp @@ -12,7 +12,7 @@ class Blitter_8bppOptimized : public Blitter_8bppBase { public: struct SpriteData { 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); diff --git a/src/debug.h b/src/debug.h index b21cd6434..8963c2efd 100644 --- a/src/debug.h +++ b/src/debug.h @@ -20,17 +20,9 @@ */ #ifdef NO_DEBUG_MESSAGES - #if defined(__GNUC__) && (__GNUC__ < 3) - #define DEBUG(name, level, args...) { } - #else - #define DEBUG(name, level, ...) { } - #endif + #define DEBUG(name, level, ...) { } #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__) - #endif + #define DEBUG(name, level, ...) if (level == 0 || _debug_ ## name ## _level >= level) debug(#name, __VA_ARGS__) extern int _debug_ai_level; extern int _debug_driver_level; diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 55b6a7468..1198e20ed 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -591,7 +591,7 @@ void GamelogGRFAddList(const GRFConfig *newg) /** List of GRFs using array of pointers instead of linked list */ struct GRFList { uint n; - const GRFConfig *grf[VARARRAY_SIZE]; + const GRFConfig *grf[]; }; /** Generates GRFList diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 0e5e620f7..50e111e4a 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -80,7 +80,7 @@ public: public: GRFText *next; byte langid; - char text[VARARRAY_SIZE]; + char text[]; }; diff --git a/src/script/squirrel_class.hpp b/src/script/squirrel_class.hpp index 20e838089..b8f098159 100644 --- a/src/script/squirrel_class.hpp +++ b/src/script/squirrel_class.hpp @@ -5,14 +5,6 @@ #ifndef 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 * and calling of such classes, to make the AI Layer cleaner while having a diff --git a/src/script/squirrel_helper_type.hpp b/src/script/squirrel_helper_type.hpp index c886d6700..3b340ad8e 100644 --- a/src/script/squirrel_helper_type.hpp +++ b/src/script/squirrel_helper_type.hpp @@ -7,7 +7,7 @@ struct Array { int32 size; - int32 array[VARARRAY_SIZE]; + int32 array[]; }; #endif /* SQUIRREL_HELPER_TYPE_HPP */ diff --git a/src/signal.cpp b/src/signal.cpp index f42819894..b7df907e6 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -19,8 +19,7 @@ enum { SIG_GLOB_UPDATE = 64, ///< how many items need to be in _globset to force update }; -/* need to typecast to compile with MorphOS */ -assert_compile((int)SIG_GLOB_UPDATE <= (int)SIG_GLOB_SIZE); +assert_compile(SIG_GLOB_UPDATE <= SIG_GLOB_SIZE); /** incidating trackbits with given enterdir */ static const TrackBitsByte _enterdir_to_trackbits[DIAGDIR_END] = { diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 1be68f681..d93044d72 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -67,7 +67,7 @@ static SpriteCache *AllocateSpriteCache(uint index) struct MemBlock { size_t size; - byte data[VARARRAY_SIZE]; + byte data[]; }; static uint _sprite_lru_counter; diff --git a/src/spritecache.h b/src/spritecache.h index a8d0ce144..1d7c5d3b1 100644 --- a/src/spritecache.h +++ b/src/spritecache.h @@ -12,7 +12,7 @@ struct Sprite { uint16 width; int16 x_offs; int16 y_offs; - byte data[VARARRAY_SIZE]; + byte data[]; }; extern uint _sprite_cache_size; diff --git a/src/stdafx.h b/src/stdafx.h index d6b735cd9..24c9e799d 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -116,9 +116,6 @@ #define printf pspDebugScreenPrintf #endif /* PSP */ -/* by default we use [] var arrays */ -#define VARARRAY_SIZE - /* Stuff for GCC */ #if defined(__GNUC__) #define NORETURN __attribute__ ((noreturn)) @@ -129,11 +126,6 @@ /* 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. */ #define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args))) - - #if (__GNUC__ == 2) - #undef VARARRAY_SIZE - #define VARARRAY_SIZE 0 - #endif #endif /* __GNUC__ */ #if defined(__WATCOMC__) diff --git a/src/strings.cpp b/src/strings.cpp index 3adcc949d..9f2f5261a 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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); struct LanguagePack : public LanguagePackHeader { - char data[VARARRAY_SIZE]; // list of strings + char data[]; // list of strings }; static char **_langpack_offs; diff --git a/src/table/sprites.h b/src/table/sprites.h index c9ca6c98d..3f8e1f79b 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -1450,7 +1450,7 @@ enum SpriteMasks { assert_compile( (1 << TRANSPARENT_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 << RECOLOUR_BIT & PALETTE_MASK) == 0 ); |