Commit graph

11 commits

Author SHA1 Message Date
Kp 98b7679732 Remove obsolete MacOS C source files
These are not referenced in SConstruct.  messagebox.c uses C linkage for
symbols that would be referenced from a C++ file, so this has likely
been broken since the common code moved to C++.
2022-10-02 19:51:36 +00:00
Kp 78d4a36bb4 Explicitly require support for C++11 constructor inheritance
Parts of the code already used the C++11 syntax, so compilers without it
were already unsupported.  Expand the remaining uses to the standard
syntax.
2022-01-09 15:25:42 +00:00
Kp e1aac6949a Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp 770ae0cea5 Replace __attribute_noreturn with C++11 [[noreturn]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:50 +00:00
Kp 6e4b63e098 Use C++17 std::size instead of custom lengthof
lengthof was added to provide the size of C arrays.  C++17 std::size is
now available, and can serve the same purpose.  Remove the custom
lengthof.

The generated code is the same in both cases, other than the change in
line numbers caused by removal of the #include directives.
2020-07-05 23:34:32 +00:00
Kp 46d72a29c0 Retire compiler-begin.h
This was once a compatibility shim, but compiler support for std::begin
has been required since 5e434cbe95 and no
issues have been reported.  Flatten the include tree by removing this
header and using the STL names directly.
2020-06-10 02:25:32 +00:00
Kp 3ce1f2b3ed Require support for C++11 addressof 2020-05-02 21:18:43 +00:00
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation.  In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.

Switch to the compiler-provided version for both gcc and clang.
2020-04-26 17:26:23 +00:00
Kp f175949412 Add DXX_ptrdiff_cast_int,DXX_WORDS_BIGENDIAN to VS2017 dxxsconf.h 2018-01-22 04:50:10 +00:00
Kp 4d155527b1 Remove mve_main.c from project builds
It is a test remnant not used as part of the regular game.
2018-01-22 04:50:10 +00:00
Kp bc9e0ea196 Update contributed Visual Studio files to Visual Studio 2017
Visual Studio 2013 support was experimental and never worked due to
missing C++11 support in the compiler and various compiler bugs that
caused it to crash on some of the more complicated files.  Microsoft
never issued sufficient patches to get Visual Studio 2013 to compile
Rebirth successfully.

Remove the Visual Studio 2013 files and add files to build Rebirth with
Visual Studio 2017.  Visual Studio 2017 support is also experimental and
is also currently broken.  Among the known problems:

- Visual Studio 2017's C99 preprocessor support, like those of predecessor versions, is deficient regarding variadic macros, causing it to reject valid constructs with confusing error messages.

	common\include\window.h(170): error C2672: 'con_puts_literal': no matching overloaded function found
	common\include\window.h(170): error C2780: 'void con_puts_literal(const con_priority,const char (&)[len])': expects 2 arguments - 1 provided
	common\include\console.h(44): note: see declaration of 'con_puts_literal'
	common\include\window.h(170): error C2664: 'void con_printf(con_priority,const char *,...)': cannot convert argument 1 from 'const char [54]' to 'con_priority'

  Visual Studio 2017's preprocessor expanded this line to:

	 ( ((void)(("%s:%u: sending event %s to window of dimensions %dx%d"))), (sizeof("file, line, e, c.cv_bitmap.bm_w, c.cv_bitmap.bm_h") == 1) ? (con_puts_literal(("%s:%u: sending event %s to window of dimensions %dx%d"))) : (con_printf(("%s:%u: sending event %s to window of dimensions %dx%d") ,file, line, e, c.cv_bitmap.bm_w, c.cv_bitmap.bm_h)) );

  gcc-5.4.0's preprocessor expanded this line to:

	 ( ((void)(("%s:%u: sending event %s to window of dimensions %dx%d"))), (sizeof("file, line, e, c.cv_bitmap.bm_w, c.cv_bitmap.bm_h") == 1) ? (con_puts_literal(CON_DEBUG ,("%s:%u: sending event %s to window of dimensions %dx%d"))) : (con_printf(CON_DEBUG ,("%s:%u: sending event %s to window of dimensions %dx%d") , file, line, e, c.cv_bitmap.bm_w, c.cv_bitmap.bm_h)) );

  Note the absence of the leading "CON_DEBUG," in the Visual Studio
  version.

- Visual Studio 2017 sometimes disallows inner classes access to private typedef symbols in the containing class.  Both gcc and clang permit this and the standard says this should work.  This is shown mixed in as part of the next error.
- Visual Studio 2017's cl.exe crashes processing some files.  Including "segment.h" is sufficient to crash cl.exe.  Before crashing it prints:

	common\include\fwd-valptridx.h(200): error C2833: 'operator integral_type' is not a recognized operator or type
	common\include\fwd-valptridx.h(201): note: see reference to class template instantiation 'valptridx<managed_type>::magic_constant<constant>' being compiled
	common\include\fwd-valptridx.h(202): note: see reference to class template instantiation 'valptridx<managed_type>' being compiled
	common\main\fwd-segment.h(19): note: see reference to class template instantiation 'std::integral_constant<::size_t,9000>' being compiled
	common\include\fwd-valptridx.h(200): error C2059: syntax error: 'newline'
	common\include\fwd-valptridx.h(200): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
	common\main\fwd-segment.h(48): error C2248: 'valptridx<d2x::segment>::specialized_types': cannot access private typedef declared in class 'valptridx<d2x::segment>'
	common\include\fwd-valptridx.h(87): note: see declaration of 'valptridx<d2x::segment>::specialized_types'
	common\main\fwd-segment.h(46): note: see declaration of 'valptridx<d2x::segment>'
	common\main\fwd-segment.h(48): note: see reference to class template instantiation 'valptridx<d2x::segment>::magic_constant<65534>' being compiled
	common\main\fwd-segment.h(48): fatal error C1903: unable to recover from previous error(s); stopping compilation

This list is not exhaustive.  The project was abandoned upon
encountering a compiler crash suspiciously similar to the one seen when
using Visual Studio 2013 to compile this code.  No one should expect
Visual Studio 2017 version 15.0.0+26228.9 to successfully compile
Rebirth, but these files are published in the hope that future patches
fix the problems in Visual Studio 2017.
2017-04-08 16:48:18 +00:00