diff options
-rw-r--r-- | Makefile.src.in | 12 | ||||
-rw-r--r-- | config.lib | 45 | ||||
-rw-r--r-- | src/signal.cpp | 20 | ||||
-rw-r--r-- | src/table/build_industry.h | 2 | ||||
-rw-r--r-- | src/table/settings.h | 2 |
5 files changed, 53 insertions, 28 deletions
diff --git a/Makefile.src.in b/Makefile.src.in index 8f6ce81d0..3b32cc824 100644 --- a/Makefile.src.in +++ b/Makefile.src.in @@ -13,6 +13,8 @@ WINDRES = !!WINDRES!! STRIP = !!STRIP!! CFLAGS = !!CFLAGS!! CFLAGS_BUILD = !!CFLAGS_BUILD!! +CXXFLAGS = !!CXXFLAGS!! +CXXFLAGS_BUILD = !!CXXFLAGS_BUILD!! LIBS = !!LIBS!! LDFLAGS = !!LDFLAGS!! LDFLAGS_BUILD = !!LDFLAGS_BUILD!! @@ -107,7 +109,7 @@ REV_NR := 0 endif # This helps to recompile if flags change -RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CFLAGS)" ]; then echo "$(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi ) +RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CXXFLAGS) $(CFLAGS)" ]; then echo "$(CXXFLAGS) $(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi ) RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi ) RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi ) @@ -140,7 +142,7 @@ $(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP) $(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP) $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)' - $(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@ + $(Q)$(CXX_HOST) $(CXXFLAGS) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@ $(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP) $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)' @@ -164,7 +166,7 @@ ifeq ("$(SRC_OBJS_DIR)/$(DEPEND)","$(MAKEDEPEND)") DEP := $(MAKEDEPEND) $(SRC_OBJS_DIR)/$(DEPEND): $(SRC_DIR)/depend/depend.cpp $(E) '$(STAGE) Compiling and linking $(DEPEND)' - $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(LDFLAGS_BUILD) -o $@ $< + $(Q)$(CXX_BUILD) $(CXXFLAGS_BUILD) $(CFLAGS_BUILD) $(LDFLAGS_BUILD) -o $@ $< endif # Make sure that only 'make depend' ALWAYS triggers a recheck @@ -232,7 +234,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)' - $(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $< + $(Q)$(CXX_HOST) $(CXXFLAGS) $(CFLAGS) -c -o $@ $< $(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP) $(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)' @@ -271,7 +273,7 @@ endian_target.h: $(ENDIAN_CHECK) $(CONFIG_CACHE_ENDIAN) $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp $(E) '$(STAGE) Compiling and Linking $@' - $(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@ + $(Q)$(CXX_BUILD) $(CXXFLAGS_BUILD) $(CFLAGS_BUILD) $< -o $@ # Revision files diff --git a/config.lib b/config.lib index 9a61d6385..70beddac1 100644 --- a/config.lib +++ b/config.lib @@ -149,7 +149,7 @@ set_default() { with_threads with_distcc with_ccache - CC CXX CFLAGS LDFLAGS" + CC CXX CFLAGS CXXFLAGS LDFLAGS" } detect_params() { @@ -393,6 +393,7 @@ detect_params() { CC=* | --CC=*) CC="$optarg";; CXX=* | --CXX=*) CXX="$optarg";; CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";; + CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";; LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";; --ignore-extra-parameters) ignore_extra_parameters="1";; @@ -1037,12 +1038,15 @@ make_compiler_cflags() { # Params: # $1 - compiler # $2 - the current cflags - # $3 - variable to finally write to - # $4 - the current ldflags - # $5 - variable to finally write to + # $3 - variable to finally write cflags to + # $4 - the current cxxflags + # $5 - variable to finally write cxxflags to + # $6 - the current ldflags + # $7 - variable to finally write ldflags to flags="$2" - ldflags="$4" + cxxflags="$4" + ldflags="$6" if [ `echo $1 | cut -c 1-3` = "icc" ]; then # Enable some things only for certain ICC versions @@ -1058,6 +1062,9 @@ make_compiler_cflags() { if [ $cc_version -ge 110 ]; then # vec report defaults to telling where it did loop vectorisation, which is not very important flags="$flags -vec-report=0" + + # Use c++0x mode so static_assert() is available + cxxflags="$cxxflags -std=c++0x" fi else # Enable some things only for certain GCC versions @@ -1099,6 +1106,11 @@ make_compiler_cflags() { flags="$flags -fno-strict-overflow" fi + if [ $cc_version -ge 43 ]; then + # Use c++0x mode so static_assert() is available + cxxflags="$cxxflags -std=c++0x" + fi + has_rdynamic=`$1 -dumpspecs | grep rdynamic` if [ -n "$has_rdynamic" ]; then # rdynamic is used to get useful stack traces from crash reports. @@ -1108,16 +1120,21 @@ make_compiler_cflags() { fi eval "$3=\"$flags\"" - eval "$5=\"$ldflags\"" + eval "$5=\"$cxxflags\"" + eval "$7=\"$ldflags\"" } make_cflags_and_ldflags() { # General CFlags for BUILD CFLAGS_BUILD="" - #LDFLAGS for BUILD + # Special CXXFlags for BUILD + CXXFLAGS_BUILD="" + # LDFLAGS for BUILD LDFLAGS_BUILD="" # General CFlags for HOST CFLAGS="$CFLAGS -D$os" + # Special CXXFlags for HOST + CXXFLAGS="$CXXFLAGS" # Libs to compile. In fact this is just LDFLAGS LIBS="-lstdc++" # LDFLAGS used for HOST @@ -1166,8 +1183,8 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -DNO_THREADS" fi - make_compiler_cflags "$cc_build" "$CFLAGS_BUILD" "CFLAGS_BUILD" "$LDFLAGS_BUILD" "LDFLAGS_BUILD" - make_compiler_cflags "$cc_host" "$CFLAGS" "CFLAGS" "$LDFLAGS" "LDFLAGS" + make_compiler_cflags "$cc_build" "$CFLAGS_BUILD" "CFLAGS_BUILD" "$CXXFLAGS_BUILD" "CXXFLAGS_BUILD" "$LDFLAGS_BUILD" "LDFLAGS_BUILD" + make_compiler_cflags "$cc_host" "$CFLAGS" "CFLAGS" "$CXXFLAGS" "CXXFLAGS" "$LDFLAGS" "LDFLAGS" if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then if [ "$os" = "CYGWIN" ]; then @@ -1443,6 +1460,7 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\"" log 1 "using CFLAGS... $CFLAGS" + log 1 "using CXXFLAGS... $CXXFLAGS" log 1 "using LDFLAGS... $LIBS $LDFLAGS" # Makedepend doesn't like something like: -isysroot /OSX/blabla @@ -1453,10 +1471,11 @@ make_cflags_and_ldflags() { # not something we can control. # Also make makedepend aware of compiler's built-in defines. if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then - cflags_makedep="`echo | $cxx_host -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`" + # Append CXXFLAGS possibly containing -std=c++0x + cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`" # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations - cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`" + cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`" else makedepend="" fi @@ -2641,6 +2660,7 @@ detect_cputype() { make_sed() { T_CFLAGS="$CFLAGS" + T_CXXFLAGS="$CXXFLAGS" T_LDFLAGS="$LDFLAGS" SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR" @@ -2659,6 +2679,8 @@ make_sed() { s@!!LIPO!!@$lipo@g; s@!!CFLAGS!!@$T_CFLAGS@g; s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g; + s@!!CXXFLAGS!!@$T_CXXFLAGS@g; + s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g; s@!!STRGEN_FLAGS!!@$strgen_flags@g; s@!!LIBS!!@$LIBS@g; s@!!LDFLAGS!!@$T_LDFLAGS@g; @@ -2963,6 +2985,7 @@ showhelp() { echo " CC C compiler command" echo " CXX C++ compiler command" echo " CFLAGS C compiler flags" + echo " CXXFLAGS C++ compiler flags" echo " WINDRES windres command" echo " LDFLAGS linker flags, e.g. -L<lib dir> if you" echo " have libraries in a nonstandard" diff --git a/src/signal.cpp b/src/signal.cpp index 22adaf26c..b85c38636 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -29,19 +29,19 @@ enum { assert_compile(SIG_GLOB_UPDATE <= SIG_GLOB_SIZE); /** incidating trackbits with given enterdir */ -static const TrackBitsByte _enterdir_to_trackbits[DIAGDIR_END] = { - {TRACK_BIT_3WAY_NE}, - {TRACK_BIT_3WAY_SE}, - {TRACK_BIT_3WAY_SW}, - {TRACK_BIT_3WAY_NW} +static const TrackBits _enterdir_to_trackbits[DIAGDIR_END] = { + TRACK_BIT_3WAY_NE, + TRACK_BIT_3WAY_SE, + TRACK_BIT_3WAY_SW, + TRACK_BIT_3WAY_NW }; /** incidating trackdirbits with given enterdir */ -static const TrackdirBitsShort _enterdir_to_trackdirbits[DIAGDIR_END] = { - {TRACKDIR_BIT_X_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S}, - {TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_RIGHT_N}, - {TRACKDIR_BIT_X_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N}, - {TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LEFT_S} +static const TrackdirBits _enterdir_to_trackdirbits[DIAGDIR_END] = { + TRACKDIR_BIT_X_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S, + TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_RIGHT_N, + TRACKDIR_BIT_X_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N, + TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LEFT_S }; /** diff --git a/src/table/build_industry.h b/src/table/build_industry.h index e45c25c06..47b16c48e 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1182,7 +1182,7 @@ enum { #define MI(tbl, sndc, snd, d, pc, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \ c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \ - {tbl, lengthof(tbl), min(255, d), 0, d, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ + {tbl, lengthof(tbl), (uint8)min(255, d), 0, d, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ {a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, in, intx, s1, s2, s3, STR_UNDEFINED, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ sndc, snd, 0, 0, true, {INVALID_INDUSTRYTYPE, 0, NULL, NULL, INVALID_INDUSTRYTYPE}} /* Format: diff --git a/src/table/settings.h b/src/table/settings.h index 4fa1a872b..1f832dbc6 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -83,7 +83,7 @@ static bool UpdateClientConfigValues(int32 p1); */ #define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc, load)\ - {name, (const void*)(def), {cmd}, {guiflags}, min, max, interval, many, str, proc, load} + {name, (const void*)(def), {(byte)cmd}, {(byte)guiflags}, min, max, interval, many, str, proc, load} /* Macros for various objects to go in the configuration file. * This section is for global variables */ |