Commit graph

938 commits

Author SHA1 Message Date
Kp 888cfddabd Combine gauges left/right window boxes 2015-09-13 21:02:19 +00:00
Kp c4a8432081 Remove WORDS_NEED_ALIGNMENT memcpy src cast to const uint8_t*
The cast provokes a warning on systems that require alignment, so remove
it.  memcpy takes const void* input, so the cast is unnecessary.

Reported-by: MattWatt <https://github.com/dxx-rebirth/dxx-rebirth/issues/119>
2015-09-13 21:02:19 +00:00
Kp fb5ae4e0bc Fix various header freestanding issues 2015-09-09 03:27:52 +00:00
Kp 9ca2bc20c6 Use DXX_CONSTANT_TRUE for valptridx static checks 2015-08-22 20:43:04 +00:00
Kp 9ed4754009 Remove typedef valptridx<T>::array_managed_type managed_type##_array_t 2015-08-22 20:43:04 +00:00
Kp 2833e81ab4 Disallow copying vptr factories 2015-08-22 20:43:04 +00:00
Kp e6fab164ae Remove valptridx internal use of operator-(ptr,array) 2015-08-22 20:43:04 +00:00
Kp 2155c417cb Move array_managed_type into valptridx<T> 2015-08-22 20:43:04 +00:00
Kp f8008ca34f Only define object_array_t::object_array_t if VALGRIND 2015-08-22 20:43:04 +00:00
Kp 946048c54b Move valptridx subtypes to individual fwd headers 2015-08-22 20:43:04 +00:00
Kp a126f72bef Remove array for basic_ptr(basic_ptr<rpolicy>,array) 2015-08-22 20:43:04 +00:00
Kp fcfd3d7e54 Cast valptridx size_t to unsigned long for Windows
Windows has `typedef unsigned size_t`, so %lu triggers a format warning
for Windows targets.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/116>
2015-08-19 02:42:49 +00:00
Kp be3ab3bd81 Use range_for in PHYSFSX_checkMatchingExtension 2015-08-14 03:02:04 +00:00
Kp e5683593ef Expand ZERO_VECTOR inline 2015-08-13 03:15:53 +00:00
Kp 4f871c43fe Add compile-time check for non-overlapping vm_matrix_x_matrix 2015-08-13 03:15:52 +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 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 c47b7e383f Make template alias support mandatory 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 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 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 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 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
Kp cdb113a050 Diagnose including compiler-type_traits without dxxsconf.h 2015-07-25 23:10:45 +00:00
Kp 8594086b23 Move magic_constant definition into valptridx 2015-07-21 02:57:27 +00:00
Kp 6bd93e466f Guard args.h for LTO -Wodr 2015-07-18 21:01:56 +00:00
Kp 4c200342dd Use range_for for PHYSFS archive types 2015-07-18 21:01:55 +00:00
Kp 095e64fd5a Support serializing enum class 2015-07-18 21:01:55 +00:00
Kp 1c5399427a Work around clang name lookup bug #13983
clang searches scopes in the wrong order, causing strange failures when
an inner template has a parameter with the same name as a type in an
outer scope.

clang bug report: <https://llvm.org/bugs/show_bug.cgi?id=13983>
2015-07-13 01:09:37 +00:00
Kp 6c94416a90 Pass array from ptridx factory 2015-07-13 01:09:37 +00:00
Kp fa8dcc9113 Explicitly delete basic_ptridx(pointer_type); require array
Require the array argument for basic_ptridx, which is supplied
automatically when the factory is used.
2015-07-13 01:09:37 +00:00
Kp 1adb56f16b Make draw_mine_all static 2015-07-13 01:09:36 +00:00
Kp ff5bb37c5c Combine basic_ptr_global_factory, basic_vptridx_global_factory 2015-07-13 01:09:36 +00:00
Kp 73fdd59225 Require exact type for valptridx factory 2015-07-13 01:09:36 +00:00
Kp 745de17c41 Use T::index_type for highest_valid 2015-07-13 01:09:36 +00:00
Kp fdd2356eac Use segptridx for Cursegp, Markedsegp 2015-07-12 01:04:18 +00:00
Kp 8b7c5c3e2b Rewrite valptridx
Move decisions out to policy classes.  Provide trivial copy
construction/assignment.  Simplify checking for unsafe conversions.
2015-07-09 03:12:45 +00:00
Kp 658102a868 Improve static_assert test
Previously, SConstruct tested whether static_assert worked with trivial
constant expressions.  Extend the test to more complicated expressions
like the ones used in the program.

Replace the typedef based approach with an inline enum to avoid warnings
about unused local typedefs.

Allow use with compilers that lack working static_assert or that cannot
accept complicated expressions.  Add a non-checking definition that uses
the input parameter.  This prevents warnings when types or constants are
used only for the static_assert.
2015-07-09 03:12:45 +00:00
Kp 4a742e3fc4 Parenthesize static_assert expression
When static_assert is a macro, it must have two arguments as seen by the
preprocessor.  Add an identity mapping to the native case to enforce
this, and fix up all the sites that break with the new rule.
2015-07-09 03:12:45 +00:00
Kp d73e5a24c3 Reduce scope of ifdef(D1||D2) 2015-07-04 21:01:17 +00:00
Kp 968cdbecf4 Add non-aborting UserError for user-caused fatal errors 2015-06-16 03:15:40 +00:00
Kp ce72014e2e Always parse WORDS_BIGENDIAN and !WORDS_BIGENDIAN 2015-06-13 22:42:21 +00:00
Kp 302e344979 Warn when UI_GADGET_* are immediately freed 2015-06-13 22:42:19 +00:00
Kp 9ecb8d8601 Use fwdvalptridx instead of inline forward declarations 2015-06-13 22:42:16 +00:00
Kp 286753d210 Fix valptridx operator& definition 2015-06-13 22:42:15 +00:00
Kp fcaacaebde Factor out valptridx test for *_none 2015-06-13 22:42:15 +00:00
Kp 8358dfcd0b Support biased pointers to help memory debuggers 2015-06-13 22:42:15 +00:00
Kp d5b5846657 Fix serial *_type -fno-inline build 2015-06-11 03:06:58 +00:00
Kp 5124c510f8 Fix serial endian_access -fno-inline build 2015-06-11 03:06:58 +00:00
Kp 64ee9e0047 Improve memdebug d_strdup trace 2015-06-11 03:06:58 +00:00
Kp 7c436f1fbb Merge pull #39 into unification/master
Requested-by: btb <https://github.com/dxx-rebirth/dxx-rebirth/pull/39>
Acked-by: Matt1360 <https://github.com/dxx-rebirth/dxx-rebirth/pull/39#issuecomment-88712761>
Acked-by: zico <https://github.com/dxx-rebirth/dxx-rebirth/pull/39#issuecomment-88907523>
2015-06-07 16:21:37 +00:00
Kp 3718678576 Reduce cvar.h includes 2015-06-07 16:20:46 +00:00
Kp f7de7d132a Add initial support for minimum_size 2015-06-05 02:34:40 +00:00
Kp a8bb0ad07d Use integral_constant for serial constants 2015-06-05 02:34:40 +00:00
Kp 39b705b352 Use integral_constant for grant masks 2015-06-05 02:34:40 +00:00
Kp a918692a23 Preprocess out EDITOR-only vm_vec_ang_2_matrix
Remove vm_vec_ang_2_matrix from non-EDITOR builds so that
sincos_2_matrix has only one caller, allowing compiler to implicitly
inline it.
2015-06-02 03:03:32 +00:00
Kp 0141e9ed78 Remove redundant fix_sincos calls
The result is immediately overwritten.  Skip computing it.
2015-06-02 03:03:32 +00:00
Kp babfa9d8e7 Construct d_event_mousebutton 2015-05-28 03:08:39 +00:00
Kp 692038f284 Cache modifier keys 2015-05-28 03:08:38 +00:00
Kp 25186ca984 Remove write-only keyd_last_released 2015-05-28 03:08:38 +00:00
Kp badad2ef33 Remove write-only keyd_last_pressed 2015-05-28 03:08:38 +00:00
Kp abfd8e4d83 Split mouse_toggle_cursor 2015-05-28 03:08:38 +00:00
Kp 73300a285d Merge "change u_int*_t to C99 standard uint*_t"
Requested-by: btb <https://github.com/dxx-rebirth/dxx-rebirth/pull/67>
Acked-by: Matt1360 <https://github.com/dxx-rebirth/dxx-rebirth/pull/67#issuecomment-104806115>
2015-05-23 17:36:29 +00:00
Kp 63cea8bb23 Fix gcc-4.6 ui build
gcc-4.6 chokes on `static constexpr type value{};`, but accepts
`static constexpr auto value = type{};`

Fixes: 95e3ac1e5b ("Use integral_constant for UI kind")
2015-05-22 03:33:19 +00:00
Kp 0fc7b1898c Fix gcc-4.6 serial build
gcc-4.6 chokes on `static constexpr type value{};`, but accepts
`static constexpr auto value = type{};`

Fixes: 9595aec2fb ("Use integral_constant for endian constants")
2015-05-22 03:33:19 +00:00
Kp cc2a5e9790 Use gr_free_bitmap_data for Orb_icons 2015-05-22 03:33:19 +00:00
Bradley Bell bdacd2f7d7 change u_int*_t to C99 standard uint*_t 2015-05-18 17:12:53 -07:00
Kp 265ad59e9c Remove set_default_handler
standard_handler is the only handler.  Use it directly.
2015-05-14 02:23:13 +00:00
Kp e50b0d479e Inline event_mouse_get_delta 2015-05-14 02:23:13 +00:00
Kp 2a8b79f868 Inline event_mouse_get_button 2015-05-14 02:23:13 +00:00
Kp 0ece005dfa Use screen_mode for screen resolution 2015-05-14 02:23:13 +00:00
Kp 2d9af1e348 Propagate gr_init argument 2015-05-14 02:23:13 +00:00
Kp 38e8967fba Split event_toggle_focus 2015-05-09 17:39:03 +00:00
Kp f248006df5 Remove unused mouse_get_btns 2015-05-09 17:39:03 +00:00
Kp 044ef0773a Shorten partial_range error reporting 2015-05-09 17:39:02 +00:00
Kp f92e890f50 Improve valptridx exception reporting 2015-05-09 17:39:02 +00:00
Kp 29f239d6b1 Raise PHYSFSX_exists bool check to caller
All callers use a constant value, so raise the check into the caller to
let the optimizer delete the unnecessary branch.
2015-05-09 17:39:02 +00:00
Kp 371838c74e Use unique_ptr to manage GLsync fence 2015-05-09 17:39:01 +00:00
Kp 2e2c17669c Shorten timer_delay 2015-05-09 17:39:01 +00:00
Kp b1992b5e59 Shorten timer_delay2 2015-05-09 17:39:01 +00:00
Kp 6dccb811b7 Pass unsigned x/y to gr_pixel 2015-05-09 17:39:00 +00:00
Kp cf87ebe54d Remove write-only grs_bitmap::bm_handle 2015-05-09 17:38:59 +00:00
Kp b124b3d75f Shorten Hline/Vline 2015-05-09 17:38:59 +00:00
Kp ae8ee3651a Enable vcvalptr(P*) 2015-05-09 17:38:58 +00:00
Kp bdee338e34 Preserve array size for ui_get_filename 2015-05-09 17:38:58 +00:00
Kp 36ce989db6 Refactor get_next_segment 2015-05-09 17:38:58 +00:00
Kp fc4b686d9d Store PHYSFS_list element count in list when needed 2015-05-09 17:38:57 +00:00
Kp 9dc22b1ee6 Expand DXX_CXX11_EXPLICIT_DELETE
Various functions use the non-macro form, so support for =delete is
already mandatory.  Remove the remnants of support for compilers which
lack =delete and replace it with a hard stop when the compiler rejects
declaring explicitly deleted functions.
2015-05-01 02:18:33 +00:00
Kp 6431b9d821 Include <cstdint> for maths.h 2015-04-30 03:32:26 +00:00
Kp a5b83d19de Simplify fix_sin/fix_cos calls 2015-04-29 03:35:09 +00:00
Kp e30e0ebb94 Shorten vm_vec_copy_scale 2015-04-29 03:35:09 +00:00
Kp 67e5e8c6c1 Remove unused gr_make_blend_table 2015-04-26 20:15:57 +00:00
Kp ace2235ad8 Remove unused gr_make_cthru_table 2015-04-26 20:15:57 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp c3925353fd Use null_sentinel_iterator for PHYSFS_list_t 2015-04-26 20:15:51 +00:00
Kp 44adc83ca4 Use std::remove_if in file_get*list 2015-04-26 20:15:50 +00:00
Kp 5d0a640449 Always inline PHYSFS check functions
The checking is done at compile time, so force them inline to ensure
the optimizer recognizes constants.
2015-04-26 20:15:50 +00:00
Bradley Bell a63ec5bd7c Merge branch 'unification/master' into command-line 2015-04-25 12:27:16 -07:00
Kp 23364a5862 Remove warn_unused_result from vm_vec_normalize
Some callers want the side effect of normalizing the argument and do not
need the magnitude.  Per report from btb, the warning broke the OS X
build.

Reported-by: btb <5e4bd5c73f (commitcomment-10899878)>
Fixes: 5e4bd5c73f ("vm_vec_delta_ang: check for vm_vec_copy_normalize failure")
2015-04-25 16:56:25 +00:00
Bradley Bell 844aad2639 Merge branch 'unification/master' into command-line 2015-04-24 20:54:35 -07:00
Kp 6e9638531a Mark get_previous_segment static 2015-04-22 02:44:31 +00:00
Kp 9595aec2fb Use integral_constant for endian constants 2015-04-19 04:18:50 +00:00
Kp 5c73a98827 Remove !__cplusplus directives 2015-04-19 04:18:50 +00:00
Kp 84c638ed64 Move PHYSFS_list_t to separate header 2015-04-19 04:18:49 +00:00
Kp 150e2d2686 Convert local arrays to array<> 2015-04-19 04:18:49 +00:00
Kp 534fe7a160 Refactor valptr range checks 2015-04-18 01:21:54 +00:00
derhass e00b318bee Fix the INTEL_*() byte swapping functions
This fixes a regression from 6e96ff3e00
where WORDS_BIGENDIAN somehow was confused with WORDS_NEED_ALIGNMENT,
so that setting WORDS_NEED_ALIGNMENT resulted in assuming a big endian
machine. This completely broke the RPi build, which is little endian.

Fixes: 6e96ff3e00 ("Fix ambiguous use of INTEL_SHORT/INTEL_INT")
[Kp: added Fixes tag.]
2015-04-05 16:08:52 +00:00
Kp 5e4bd5c73f vm_vec_delta_ang: check for vm_vec_copy_normalize failure
derhass reports that Raspbian g++-4.8.2 rejects vecmat.cpp for
-Wmaybe-uninitialized on t0, t1.  Fix it by adding code to return 0 if
vm_vec_copy_normalize leaves the temporary uninitialized.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/55>
2015-04-03 02:46:25 +00:00
Kp 36e1612ecb Make undo_status array<const char *> 2015-04-02 02:36:56 +00:00
Kp 2a1df52f71 Remove unused g3_draw_bitmap return value 2015-04-02 02:36:54 +00:00
Kp 72d349b0e0 Remove unused g3_draw_sphere return value 2015-04-02 02:36:54 +00:00
Kp 1125a751db Remove unused g3_draw_poly return value 2015-04-02 02:36:54 +00:00
Kp 916cf69e37 Remove unused gr_uline return value 2015-04-02 02:36:54 +00:00
Kp ca123b6cde Remove unused gr_line return value 2015-04-02 02:36:54 +00:00
Kp c3161d08d5 Remove unused g3_draw_line return value 2015-04-02 02:36:54 +00:00
Kp 95e3ac1e5b Use integral_constant for UI kind 2015-04-02 02:36:54 +00:00
Kp f88eaf43ac Make UI_GADGET_LISTBOX char* const 2015-04-02 02:36:54 +00:00
Kp 9f04c0c3d8 Make OGL_ENABLE safe for single statement blocks 2015-04-02 02:36:54 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 66a70fd373 Prepare for global arrays to be array<> 2015-04-02 02:36:52 +00:00
Kp 6e96ff3e00 Fix ambiguous use of INTEL_SHORT/INTEL_INT 2015-04-02 02:36:52 +00:00
Kp 92b6cd3883 Replace ui_create_dialog specialization with helper
Rename ui_create_dialog<void *> specialization with free function
untyped_ui_create_dialog.  GCC 4.6 incorrectly considers a
specialization to be a redundant declaration, causing a
-Wredundant-decls failure with the specialization form.

Fixes: be041a9cfc ("Add type checking for ui_create_dialog")
2015-04-02 02:36:52 +00:00
Kp 0b20dea0ad Remove unused jukebox functions 2015-03-28 17:18:02 +00:00
Kp c4bcbb0403 Add workaround for gcc 4.6 constructor brace initialization
Reported-by: btb <https://github.com/dxx-rebirth/dxx-rebirth/pull/54#issuecomment-86252358>
2015-03-27 02:50:23 +00:00
Kp 7045b44386 Move operator*(vm_distance,vm_distance) into class scope
clang -Wunused-function warns about a 'static constexpr' function
defined in a header if the header is ever included in a file which does
not call the function.  Move the function into class scope to silence
the warning and prevent the compiler from considering it when resolving
operator*(T1,T2).

Reported-by: btb <https://github.com/dxx-rebirth/dxx-rebirth/pull/54#issuecomment-86252750>
2015-03-26 02:42:26 +00:00
Kp ff83ba95b6 Remove unused ogl_extensions_init return value 2015-03-25 01:59:21 +00:00
derhass 639b569496 Merge branch 'unification/master' into unification/syncgl_v2
Conflicts:
	similar/arch/ogl/gr.cpp
	similar/misc/args.cpp
2015-03-23 20:18:17 +01:00
derhass 6d41224638 move GL synchronization code into its own class 2015-03-22 21:19:06 +01:00
derhass db267af6f2 add basic OpenGL extension handling
Currently only used for fence sync objects.
2015-03-22 20:32:14 +01:00
Kp d04e7902ee Make file_get*list static 2015-03-22 18:49:21 +00:00
Kp 2b44a352ca Remove redundant sc_mode
sc_mode is a packed copy of sc_w/sc_h.  Switch to an accessor that uses
the copy.
2015-03-22 18:49:21 +00:00
Kp fca381727c Add wrappers for screen width/height 2015-03-22 18:49:21 +00:00
Kp 8daa014d53 Remove unused gr_check_mode 2015-03-22 18:49:21 +00:00
Kp f098471e54 Make sdl_video_flags static 2015-03-22 18:49:21 +00:00
Kp 08c0c3768c Remove unused gr_set_draw_buffer 2015-03-22 18:49:21 +00:00
Kp 7bf49fe551 Fix clang -Wmissing-braces warnings 2015-03-22 18:49:21 +00:00
Kp 9ddea5f570 Reduce lifetime of Args 2015-03-22 18:49:20 +00:00
derhass 2cd73b6dfe Import the syncgl patch based on 0.58.1 into unification code base
I also changed the command line arguments a bit, gl_syncmethod and
gl_sycnwait are used now. Furthermore, I added the ew mode AUTO. This is
a conservative mode and the default for now: if GL_ARB_sync is available,
use the FENCE_SLEEP mode, otherwise, disable it completely.

Conflicts:
	include/args.h
	misc/args.c
	similar/arch/ogl/gr.cpp
2015-03-22 18:17:11 +01:00