Commit graph

8486 commits

Author SHA1 Message Date
Kp 2eda0d98ee Add workaround for Win32 array::size() triggering -Wuseless-cast
As described in commit 674a921 ("Add workaround for Win32 wrong type for
size_t"), std::array on Win32 returns type std::size_t, which is
`unsigned int` instead of the `unsigned long` seen on Linux.  Calling
std::min requires both arguments to have the same type.  On Linux, this
required casting the result of size() to `unsigned` to match the other
input.  On Win32, that cast provokes a -Wuseless-cast warning.  Add a
workaround by removing the cast and instead explicitly setting the type
of std::min's arguments to `unsigned`, then relying on the compiler to
perform an implicit conversion from `unsigned long` to `unsigned int`
on Linux.  The value is always small enough to fit in an `unsigned int`,
so no precision loss will occur.
2016-08-19 03:41:42 +00:00
Kp e3ecc0715c Remove useless cast in similar/main/net_udp.cpp 2016-08-19 03:41:42 +00:00
Kp bbdecad649 Add helper macro to handle printf .* conversion for 32/64
Field width conversion `.*` always takes an `int`.

On Win32, casting `long` to `int` triggers a `-Wuseless-cast` warning.
Omitting the cast works correctly.

On Linux/amd64, casting `long` to `int` works correctly.
Omitting the cast triggers a `-Wformat` warning.

Add a macro that conditionally expands to `static_cast<int>` or to ``,
as necessary for the target platform.
2016-08-19 03:41:41 +00:00
Kp 7f0f269aec Switch write_netgame_profile to use inttypes format macros
Most 64-bit systems use `unsigned long` for `uint_fast32_t`.  Some
32-bit systems use `unsigned int` for `uint_fast32_t`.  To handle this,
write_netgame_profile used casts to `unsigned` and a format string of
`%u`.  Switch to inttypes format macros so that the format strings are
correct without requiring a cast to handle systems where `uint_fast32_t`
is not `unsigned`.
2016-08-19 03:41:41 +00:00
Kp b87651216c Switch ab_load to use inttypes format macros
Most 64-bit systems use `unsigned long` for `uint_fast32_t`.  Some
32-bit systems use `unsigned int` for `uint_fast32_t`.  To handle this,
ab_load used casts to `unsigned long` and a format string of `%lu`.
Switch to inttypes format macro so that the format string is correct
without requiring a cast to handle systems where `uint_fast32_t` is not
`unsigned long`.
2016-08-19 03:41:41 +00:00
Kp d554b01e45 Remove useless casts in similar/editor/meddraw.cpp 2016-08-19 03:41:41 +00:00
Kp fca91b78c7 Remove useless casts in similar/main/multi.cpp 2016-08-19 03:41:41 +00:00
Kp b9399c5048 Switch multi_process_bigdata to use inttypes format macros
Most 64-bit systems use `unsigned long` for `uint_fast32_t`.  Some
32-bit systems use `unsigned int` for `uint_fast32_t`.  To handle this,
multi_process_bigdata used casts to `unsigned long` and a format string
of `%lu`.  Switch to inttypes format macros so that the format strings
are correct without requiring a cast to handle systems where
`uint_fast32_t` is not `unsigned long`.
2016-08-19 03:41:41 +00:00
Kp 9be68f4e99 Add SConf test for struct timespec 2016-08-19 03:41:40 +00:00
Kp 0c43357d85 Move HMP->MIDI magic numbers into magic_header[]
This removes some useless casts from the serializer.
2016-08-19 03:41:40 +00:00
Kp c6f20901d3 Move lazy object getters into default argument scope 2016-08-19 03:41:40 +00:00
zico dad3e953e9 Retored historically accurate versions of homing tracking and lifeleft calculations for D1X and D2X based on their original source code releases instead of mixing them together. Further encabsuled NEWHOMER code to disable unused functions and variables if NEWHOMER is disabled. 2016-08-17 13:43:01 +02:00
Kp 9e31914e6a Remove useless casts in similar/main/playsave.cpp 2016-08-17 04:44:22 +00:00
Kp cc74c91c89 Remove useless casts in similar/main/newdemo.cpp 2016-08-17 04:44:22 +00:00
Kp 70df47da32 Remove useless casts in similar/main/multibot.cpp 2016-08-17 04:44:22 +00:00
Kp 37fed077ee Remove useless casts in similar/arch/ogl/ogl.cpp 2016-08-17 04:44:22 +00:00
Kp 9b3adfb020 Remove useless casts in similar/arch/ogl/gr.cpp 2016-08-17 04:44:22 +00:00
Kp 6dc16bf468 Remove useless cast in similar/2d/pcx.cpp 2016-08-17 04:44:22 +00:00
Kp b1d88fd378 Remove useless cast in similar/main/iff.cpp 2016-08-17 04:44:22 +00:00
Kp cb99240c2c Remove useless casts in d2x-rebirth/libmve/decoder8.cpp 2016-08-17 04:44:22 +00:00
Kp 4b92942bb6 Switch newdemo.cpp to cast Secondary_weapon like Primary_weapon
Both Primary_weapon and Secondary_weapon should use the underlying enum
type.  Primary_weapon uses its enum type now.  Secondary_weapon will use
its enum type eventually.  Add appropriate casts to newdemo.cpp to keep
it working when those changes are made.
2016-08-17 04:44:22 +00:00
Kp bc7f627a36 Cache Link in SConstruct check_preferred_compiler_options 2016-08-17 04:44:22 +00:00
Kp 7f3b725c40 Use std::swap to exchange mveplay back buffer pointers 2016-08-17 04:44:22 +00:00
Kp 9924e66082 Replace implicit getter via property with explicit getter calls
Rename members to reflect that they are now explicit getters.
2016-08-17 04:44:22 +00:00
Kp a44498a1ae Improve reporting of bad $CXXFLAGS/$LDFLAGS/$LIBS 2016-08-17 04:44:22 +00:00
Kp 5df6dc47fb Simplify PCH filename passing 2016-08-17 04:44:22 +00:00
Kp 522c37b898 Move -mwindows from DXXProgram to DXXCommon
Environment tests should use it since it is used for the main
executable.
2016-08-14 23:47:27 +00:00
Kp 11519b4a75 Update documentation and test to exclude <gcc-4.9 2016-08-14 23:47:26 +00:00
Kp 1ca0dacb6c Cache context.sconf.Define 2016-08-13 22:20:13 +00:00
Kp 1cb62b1815 Compute Conftests self.Compile at __init__ time 2016-08-13 22:20:13 +00:00
Kp d3535e8486 Prefilter configure test names 2016-08-13 22:20:13 +00:00
Kp cbf745eb9a Switch DXXProgram._computed_extra_version to staticmethod
It did not use its class argument, so remove it.
2016-08-13 22:20:13 +00:00
Kp 20294a54ac Remove dead statements in DXXCommon.process_user_settings 2016-08-13 22:20:13 +00:00
Kp 74525090e7 Update get_found_includes hook for newer SCons
Newer SCons applied a performance optimization that breaks a technique
used in the check_header_includes=1 build.  Switch to a technique that
should work reliably on old and new SCons, although with slightly
reduced efficiency in both cases.  The effective performance penalty
should be unnoticeable and only applies to developers building with
check_header_includes=1.
2016-08-12 04:08:57 +00:00
Kp 8a4908ea2f Precompute and save C++11 required feature list
The C++11 required feature string was computed once per configured
environment.  When two or more environments were configured in a single
run, this was wasteful.  Reorder the SConf tests to precompute the
string.
2016-08-12 04:08:57 +00:00
Kp 7b173c3570 Fold use of raise StopError 2016-08-12 04:08:57 +00:00
Kp 4cb3d46148 Move <type_traits> test to Cxx11RequiredFeature
Commit 957016621e ("Remove support for
Boost.TypeTraits") removed support for any alternative implementation of
<type_traits>, so C++11 <type_traits> is now required.  Move it to
the Cxx11RequiredFeature array to combine it with the other required
feature tests.
2016-08-08 00:07:20 +00:00
Kp 95a53ed820 Require C++11 range-based for
Fallback support for Boost.Foreach is broken and no one has reported it.
The minimum required gcc version supports range-based for.  Recent Clang
supports range-based for.  No Microsoft compilers are supported.  Remove
support for the fallback Boost.Foreach and move the C++11 range-based
for test to the Cxx11RequiredFeature array.
2016-08-08 00:07:19 +00:00
Kp 1d1f3f6568 Allocate fewer jukebox pointers for small files 2016-08-08 00:07:19 +00:00
Kp 7ac89d0a14 Update jukebox song count at end of read_m3u 2016-08-08 00:07:19 +00:00
Kp 2885070ba8 Remove unnecessary ~jukebox_songs
The storage is managed by a unique_ptr, so the default destructor is
sufficient.
2016-08-08 00:07:19 +00:00
Kp 68ac4acd10 Combine jukebox allocations 2016-08-06 19:55:26 +00:00
Kp 8247713850 Use RAII for m3u FILE* 2016-08-06 19:55:26 +00:00
Kp 66422a2ea3 Combine PHYSFSX_isNewPath calls in select_file_recursive2 2016-08-06 19:55:26 +00:00
Kp 5b71faacda Use RAII to remove temporary PHYSFS search path 2016-08-06 19:55:25 +00:00
Kp a09dce6ead Remove char[N] overload for PHYSFSX_getRealPath 2016-08-06 19:55:25 +00:00
Kp a98510b17e Move CMLevelMusicTrack to CCfg 2016-08-06 19:55:25 +00:00
Kp 771665835d Move LastMission to CCfg 2016-08-06 19:55:25 +00:00
Kp ac8232caca Move CMMiscMusic to CCfg 2016-08-06 19:55:25 +00:00
Kp 50599c0dad Move CMLevelMusicPath to CCfg 2016-08-06 19:55:25 +00:00