Commit graph

82 commits

Author SHA1 Message Date
Daniel Gibson
86c634b55c Fix new[]/delete missmatches and memory leaks found by clang's ASAN
Sometimes memory was allocated with new[] but freed with delete instead
of delete[], which is wrong.
And there were some small memory leaks, too.
Furtunately clang's AddressSanitizer detected all that so I could easily
fix it.

(There seem to be some more small memory leaks which are harder to fix,
though)
2018-08-20 01:46:39 +02:00
Daniel Gibson
018e13feef Unix: On failed assertion, break gracefully into debugger
__builtin_trap() causes an illegal instruction and thus the process
can't resume afterwards.
raise(SIGTRAP) only breaks into the debugger and thus allows to
"ignore" the assertion while debugging.
2018-08-20 01:46:39 +02:00
leffmann
99bbd70af5 make idlib build with Visual Studio 14 2018-08-20 01:46:39 +02:00
Daniel Gibson
34490bb875 Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup) 2018-08-20 01:46:38 +02:00
Tobias Frost
7b7c7a5238 Fixing some spelling errors: s/unkown/unknown, s/seperate/separate. (#107) 2018-08-20 01:46:38 +02:00
Daniel Gibson
ba549be284 math.h should #include sys/platform.h
Similar to f317b05
2018-08-20 01:46:37 +02:00
Daniel Gibson
20879f6972 List.h needs sys/platform.h for ID_INLINE
Everytime List.h is included in a new file (and sys/platform.h isn't)
there are confusing compiler-errors..
So just #include sys/platform.h in List.h directly, because it uses
ID_INLINE which is defined there
2018-08-20 01:46:37 +02:00
Daniel Gibson
d1527301b0 Use current type for BT_CLOSED enum
doesn't really make a difference code-wise, but removes one compiler warning.
2018-08-20 01:46:37 +02:00
Daniel Gibson
01545faf94 Get rid of some compiler warnings
GCC had shitloads of superfluous warnings wherever List.h and Str.h were
included.. get rid of them by using #pragma GCC diagnostic at some places
in List.h and Str.h.
Also add some casts, initialize some variables for other warnings
2018-08-20 01:46:37 +02:00
dhewg
eb38c04357 Get rid of precompiled.[h|.cpp]
Both unused, except for the mfc editors, which don't compile anyway.
2018-08-20 01:46:36 +02:00
dhewg
d832144482 Use _exit() in AssertFailed()
Ensure application exit.
2018-08-20 01:46:35 +02:00
dhewg
575668da57 Replace "__asm int 0x03" with __debugbreak()
Fixes compilation with msvc 64bit.
2018-08-20 01:46:35 +02:00
dhewg
d16d3a5534 Only compile msvc style asm with 32bit msvc
The 64bit compiler doesn't support __asm.
2018-08-20 01:46:35 +02:00
dhewg
a385bbeb29 Fixes issues with MacOSX.
- Fixes compiler errors with mismatching types in DoomController.mm
- Adds PPC_INTRINSICS fix to Simd_Altivec.h
2018-08-20 01:46:33 +02:00
dhewg
8dfc6df02a s/ReadDeltaLong/ReadDeltaInt/
to match the argument type
2018-08-20 01:46:33 +02:00
dhewg
8cd1580d60 s/WriteDeltaLong/WriteDeltaInt/
to match the return type
2018-08-20 01:46:33 +02:00
dhewg
ae319dbe4a s/ReadDeltaLongCounter/ReadDeltaIntCounter/
to match the return type
2018-08-20 01:46:33 +02:00
dhewg
c971755d98 s/WriteDeltaLongCounter/WriteDeltaIntCounter/
to match the argument type.
2018-08-20 01:46:33 +02:00
dhewg
431415c51c s/ReadLong/ReadInt/ to match the return type 2018-08-20 01:46:33 +02:00
dhewg
814abb55b9 s/WriteLong/WriteInt/ to match the argument type 2018-08-20 01:46:33 +02:00
dhewg
a9ffb336f6 s/BigLong/BigInt/ to match the return type 2018-08-20 01:46:33 +02:00
dhewg
420783b151 s/LittleLong/LittleInt/ to match the return type 2018-08-20 01:46:33 +02:00
Daniel Gibson
a9a6042a04 Remove usage of long type from idlib/
Apart from some minor stuff, this changes the signature of some methods
of Parser and Token classes and of the (unused) Random2 class.
That no problem though, because the calling code uses normal ints
anyway.
2018-08-20 01:46:33 +02:00
Daniel Gibson
d51c05c768 Fix idMatX::IsOrthonormal()
The original implementation was pretty broken (but not used anyway),
it is now fixed and improved a bit (got rid of one inner loop).
This (at least part of the problem) was detected by PVS-Studio,
see http://www.viva64.com/en/b/0120/ Fragment 3
2018-08-20 01:46:33 +02:00
dhewg
c5c5762ae4 Fix "unreachable code" warnings 2018-08-20 01:46:32 +02:00
dhewg
5fa6e06748 Use SDL GLimp and input implementations on Windows
The DirectX SDK is not required anymore.
2018-08-20 01:46:30 +02:00
spiral
3dc6127529 Remove MWERKS stuff 2018-08-20 01:46:29 +02:00
dhewg
01b5e365e8 Fix alignment issue with idBlockAlloc::Free()
Bug introduced with e97d3288. This doesn't work with MinGW, since
the struct members might not be aligned to the native pointer
size (in this case idSampleDecoderLocal was aligned to a 8 byte
boundary on win32).
Just switch the two members to avoid ugly code.
2018-08-20 01:46:29 +02:00
dhewg
27c5fd76ff Fix -Woverloaded-virtual warnings
We want to use the SIMD functions of the base class if the
deriving class does not implement every overloaded variant.

Added missing idLight::SetColor(idVec3) which is declared in
idEntity.
2018-08-20 01:46:29 +02:00
dhewg
a86defb0ca Change another _WIN32 to _MSC_VER for MinGW
Older MinGW versions do not know about __assume().
Change _WIN32 in comments too to match their opening #if.

Reported by serpentine.
2018-08-20 01:46:29 +02:00
dhewg
84d64029e5 New define IDSTR_NO_REDIRECT
The defines in idlib/Str.h won't be set to redirect the low
level c string functions to idStr when IDSTR_NO_REDIRECT is
set.

Fixes compilation for MSVC:
error C2761: 'Cmp' : member function redeclaration not allowed

Reported by spiral.
2018-08-20 01:46:29 +02:00
spiral
139726bc37 Add missing includes for MSVC
- MSVC doesn't provide C99 headers
- Default to min. req. 64Mb video mem if no COM present
- Move misplaced __attribute__((packed)) from MSVC to MinGW
2018-08-20 01:46:29 +02:00
dhewg
975cda1637 Unify CPUID_FTZ and CPUID_DAZ
Get rid of the 2 CPUID flags and combine them with SSE in one
implementation.
SSE flags can now be set on all x86 and x86_64 platforms -
independent of -ffast-math.
Helper defines borrowed from STREFLOP.
2018-08-20 01:46:29 +02:00
dhewg
79ad74d779 Use idSys::GetMilliseconds() for idTimer
The class is only used for debugging and statistical purposes.
The precision is now reduced to milliseconds, but that's only
relevant for fine grained debug timings - where the old code
was inaccurate at anyway.
2018-08-20 01:46:29 +02:00
dhewg
f41d2347b1 Use SDL for everything endian 2018-08-20 01:46:29 +02:00
dhewg
afebd7e1e5 Untangle the epic precompiled.h mess
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.
2018-08-20 01:46:28 +02:00
dhewg
8f4d16fd1b Move BuildDefines.h include to platform.h 2018-08-20 01:46:27 +02:00
dhewg
487406d861 Move idlib typedefs to platform.h 2018-08-20 01:46:27 +02:00
dhewg
e522e719dd Move common includes from precompiled.h to platform.h 2018-08-20 01:46:27 +02:00
dhewg
7d52a803ab Split platform specific code from precompiled.h
New header sys/platform.h.
2018-08-20 01:46:27 +02:00
dhewg
d76358afc2 Move the virtual abstract idGame to framework/Game.h
This is game independent and code outside of game/ and d3xp/
doesn't need to know about anything game specific.
2018-08-20 01:46:27 +02:00
dhewg
e8965eb6fb Move the game include directory to the build system
Don't include based on a preprocessor symbol, let the build
system make the correct decision.
2018-08-20 01:46:27 +02:00
dhewg
4f90a1db12 Partly restore behaviour from c17b80e9
The subtraction was inverted, but change back the behaviour too:
Hardcode offsets and check via asserts() in Debug builds.
2018-08-20 01:46:27 +02:00
dhewg
bc5f5c785a Get rid of all idAudioHardware implementations 2018-08-20 01:46:27 +02:00
dhewg
12d8125498 Undef strcasecmp before redefining it 2018-08-20 01:46:26 +02:00
dhewg
c39f4e9894 Only use MSVC style asm with MSVC 2018-08-20 01:46:26 +02:00
dhewg
2b446ddd28 Basic infrastructure to build with MinGW
Add WIN32 support to CMake (core and games, no dedicated for now).
Only use MFC when it is available.
2018-08-20 01:46:26 +02:00
dhewg
0b0db9ab41 Remove the unused and useless CallStack code
This was never enabled and only implemented for Windows.
2018-08-20 01:46:26 +02:00
dhewg
546323185b Fix -Wsizeof-pointer-memaccess warnings
argument to 'sizeof' in 'memset' call is the same expression as the
destination; did you mean to dereference it?
2018-08-20 01:46:26 +02:00
dhewg
72b8adfd82 Fix -Wdelete-non-virtual-dtor warnings
delete called on 'idSIMDProcessor' that is abstract but has
non-virtual destructor
2018-08-20 01:46:26 +02:00