Commit graph

7250 commits

Author SHA1 Message Date
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp bc7c469ab2 Use array<> for more globals 2015-08-12 03:11:46 +00:00
Kp 41ecab004f Skip message for unknown variables when there is nothing to do
Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/115>
Fixes: 870ed653b5 ("Warn about unknown scons variables")
2015-08-11 03:05:55 +00:00
Kp fa9f2e626d Move DbgShowMemInfo to CArg
Members of Arg are not visible to common code, so common/mem/mem.cpp
broke during the -Wodr cleanup.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/114>
Fixes: 6bd93e466f ("Guard args.h for LTO -Wodr")
2015-08-11 03:05:55 +00:00
Kp 0a3de25d7a Flatten valptridx ptr/idx further
Use a dummy template parameter to prevent slicing, instead of an extra
class in the inheritance chain.  This improves the generated code
slightly.
2015-08-07 03:13:51 +00:00
Kp 3458454f7e Flatten valptridx hierarchy 2015-08-06 02:57:59 +00:00
Kp b3d1c6efaa Use helper for valptridx array size checks 2015-08-06 02:57:58 +00:00
Kp 001fdfff37 Add workaround for gcc-4.8 ref qualifier quirk
In gcc-4.8, a member method with const lvalue and const rvalue methods
is ambiguous.

	$ cat t.cpp
	class A
	{
	public:
	    void a() const &;
	    void a() const &&;
	};

	A b();
	void c()
	{
	    b().a();	// fails in gcc-4.8, works in later
	}
	$ gcc-4.8 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	t.cpp: In function 'void c()':
	t.cpp:11:8: error: call of overloaded 'a()' is ambiguous
	  b().a();
		^
	t.cpp:11:8: note: candidates are:
	t.cpp:4:7: note: void A::a() const &
	  void a() const &;
	       ^
	t.cpp:5:7: note: void A::a() const &&
	  void a() const &&;
	       ^
	$ gcc-4.9 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	$

Fixes: bda7fef3a0 ("Use get_local_player to compute reference to local player")
2015-08-05 02:59:03 +00:00
Kp e3dbe7a07c Add workaround for gcc-4.7 type inheritance quirk
In gcc-4.7, a type inherited via using is distinct from a type defined
by using.

	$ cat t.cpp
	template <typename>
	class A
	{
	public:
	    typedef void a;
	    typedef void b;
	};

	template <typename T>
	class B : protected A<T>
	{
	protected:
	    using typename A<T>::a;
	    using b = typename A<T>::b;
	public:
	    static inline a f1();
	    static inline b f2();
	};

	template <typename T>
	typename B<T>::a B<T>::f1() {}	// fails for gcc-4.7, works in later

	template <typename T>
	typename B<T>::b B<T>::f2() {}	// works in both

	$ gcc-4.7 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	t.cpp:21:18: error: prototype for 'typename B<T>::a B<T>::f1()' does not match any in class 'B<T>'
	t.cpp:16:18: error: candidate is: static typename A<T>::a B<T>::f1()
	t.cpp:16:18: warning: inline function 'static typename A<T>::a B<T>::f1() [with T = int; typename A<T>::a = void]' used but never defined [enabled by default]

	$ gcc-4.8 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	$

Fixes: 8b7c5c3e2b ("Rewrite valptridx")
2015-08-05 02:59:03 +00:00
Kp f15116f2cb Simplify multiplayer sound handling 2015-08-05 02:59:02 +00:00
Kp 6870b48710 Remove unused return value of digi_link_sound_to_object* 2015-08-05 02:59:02 +00:00
Kp 9fb9aef509 Remove unused return value of digi_link_sound_to_pos 2015-08-05 02:59:02 +00:00
Kp b979f52ebf Centralize required C++11 features 2015-08-03 03:11:25 +00:00
Kp c47b7e383f Make template alias support mandatory 2015-08-03 03:11:25 +00:00
Kp c80d12319a Use unqualified begin/end
Most call sites use unqualified begin/end and rely on using declarations
to pick an appropriate implementation.  Fix the sites that explicitly
requested std::begin/std::end.
2015-08-03 03:11:25 +00:00
Kp 20b1db3483 Expand dxx_explicit_operator_bool to "explicit"
Many files now use "explicit", so compilers which reject
explicit operator bool() will not work.  Remove the macro.
2015-08-03 03:11:25 +00:00
Kp 49b0868230 Fix ambiguous return when constructor inheritance is missing
gcc-4.7 (and, if constructor inheritance is suppressed, later versions)
reject

	return objnum == object_none ? vcobjptr(static_cast<objnum_t>(object_first)) : objnum;

where objnum is a cobjptridx:

similar/main/digiobj.cpp: In lambda function:
similar/main/digiobj.cpp:564:85: error: operands to ?: have different types 'valptridx<object>::vcptr' and 'valptridx<object>::cptridx'
similar/main/digiobj.cpp:564:85: error: inconsistent types '<type error>' and 'valptridx<object>::vcptr' deduced for lambda return type

Fix it by removing the ternary operator and adding an appropriate
conversion cast.
2015-08-03 03:11:25 +00:00
Kp 555ff20ae9 Move render_state.h up for gcc-4.7 static_assert
In gcc-4.7, <bits/hashtable.h> uses static_assert in a way that the
preprocessor considers to have 3 arguments.  Move render_state.h up to
ensure that <bits/hashtable.h> is included before
"compiler-static_assert.h" converts static_assert into a 2 argument
macro.
2015-08-03 03:11:25 +00:00
Kp 2fb03da475 Inline multi_send_endlevel_start secret for D2 2015-08-03 03:11:25 +00:00
Kp 978cf91a96 Reduce partial_range error argument shuffling 2015-08-03 03:11:24 +00:00
Kp 7086bbae14 Simplify automatic compiler test 2015-08-03 03:11:24 +00:00
Kp eb5fcb34e6 Remove default argument for basic_ptr(reference,array) 2015-07-29 03:05:28 +00:00
Kp e0e1b28c72 Remove default argument for basic_ptr(reference,index,array) 2015-07-29 03:05:28 +00:00
Kp 84bd64a14c Remove default argument for basic_ptridx(magic,array) 2015-07-29 03:05:28 +00:00
Kp ba38214bab Remove default argument for basic_ptridx(pointer,index,array) 2015-07-29 03:05:28 +00:00
Kp 4d8ae44794 Add helper macro DXX_CONSTANT_TRUE 2015-07-29 03:05:28 +00:00
Kp cfd08b5d6c Suppress physfsx read/write macros in physfsrwops.cpp 2015-07-25 23:10:48 +00:00
Kp 4a6ae13367 Centralize PCH object hook 2015-07-25 23:10:48 +00:00
Kp a2816617fe Pass reactor& to read_model_guns 2015-07-25 23:10:48 +00:00
Kp d4dc3df3de Support PCH+LTO 2015-07-25 23:10:48 +00:00
Kp c9dff229f1 Remove dead AI fire leading code 2015-07-25 23:10:47 +00:00
Kp 822f8ad5c0 Use __builtin_object_size to check some unchecked ranges 2015-07-25 23:10:47 +00:00
Kp 2f847030ce Combine partial_range_error reporting
Use iterator type instead of container type, so that T[1] and T[2] use
the same reporting function.  This saves ~7k in an LTO build.
2015-07-25 23:10:47 +00:00
Kp 3f6a402bfd Include bound in partial_range always_error function name 2015-07-25 23:10:47 +00:00
Kp 9a5654e002 Move similar/editor/autosave.cpp -> common/editor/autosave.cpp 2015-07-25 23:10:47 +00:00
Kp de06f639fd Pass grs_bitmap& to set_lighting_flag 2015-07-25 23:10:47 +00:00
Kp 720cc9db98 Move tmap scanline pointers to structure 2015-07-25 23:10:47 +00:00
Kp 1738870b22 Make some c_tmap scanline functions static 2015-07-25 23:10:47 +00:00
Kp c942d28197 Use accessor for grs_bitmap::bm_type 2015-07-25 23:10:47 +00:00
Kp b7838318b1 Fix valptridx for -fno-inline 2015-07-25 23:10:46 +00:00
Kp 37a830f400 Switch AI key lookup 2015-07-25 23:10:46 +00:00
Kp b8cc2f4172 Inline multi_i_am_master 2015-07-25 23:10:46 +00:00
Kp 81abf3666b Reorder hoard kill tests 2015-07-25 23:10:46 +00:00
Kp bda7fef3a0 Use get_local_player to compute reference to local player 2015-07-25 23:10:46 +00:00
Kp f38e80c053 Use get_local_plrobj to compute reference to object of local player 2015-07-25 23:10:45 +00:00
Kp f00725f740 Use forward-declaration header for player.h 2015-07-25 23:10:45 +00:00
Kp 70c4cc87ab Use forward-declaration header for weapon.h 2015-07-25 23:10:45 +00:00
Kp f899aaeaca Move player callsign to player-callsign.h 2015-07-25 23:10:45 +00:00
Kp 9bfea35e4f Use forward-declaration header for gr.h 2015-07-25 23:10:45 +00:00
Kp 15fb75c1c7 Fix check_header_includes build 2015-07-25 23:10:45 +00:00