Re: clang 6 deregister games/alephone/alephone

2018-04-20 Thread Peter Hessler
On 2018 Apr 20 (Fri) at 02:55:16 +0200 (+0200), Ingo Schwarze wrote:
:Hi,
:
:Christian Weisgerber wrote on Wed, Apr 18, 2018 at 01:18:22PM +0200:
:> Peter Hessler:
:
:>> This patch set removes the "register" keyword, which is no longer
:>> legal to use.
:
:> Why bother?  It doesn't cause errors, just warnings.
:> Instead of patches, I would suggest defining it away by adding
:> -Dregister= to CXXFLAGS.
:
:My impression is that -Wno-deprecated-register might be even safer
:because it doesn't blindly change the code but just hide the
:warnings.
:
:The following patch fixes the problems that must be fixed to build
:with clang6.  They are all related to the well-known clang6 effect
:that NULL cannot be assigned to certain pointer types, in this
:case function pointers.
:
:The flag -Wno-c++11-narrowing is *really* required.  There are
:many dozen, maybe hundreds of violations scattered all over the
:place.  I suspect that some of them may actually be overflow bugs
:and result in rendering errors (or worse), but auditing for that
:is really a task for upstream, not for us (unless the MAINTAINER
:is extremely bored :).
:
:No, i'm not gonna get addicted to this game.  Testing it feels like
:brutal work.  It runs for me, and so do i.  But we want to get the
:tree back in shape, right?
:
:OK?
:  Ingo
:

It builds, it runs.

OK


:
:Index: Makefile
:===
:RCS file: /cvs/ports/games/alephone/alephone/Makefile,v
:retrieving revision 1.23
:diff -u -p -r1.23 Makefile
:--- Makefile   26 Jul 2017 22:45:20 -  1.23
:+++ Makefile   20 Apr 2018 00:46:12 -
:@@ -6,7 +6,7 @@ COMMENT =  open source game engine based
: DATE =20150620
: DISTNAME =AlephOne-${DATE}
: PKGNAME = alephone-1.2.1
:-REVISION =0
:+REVISION =1
: 
: EXTRACT_SUFX =.tar.bz2
: CATEGORIES =  games x11
:@@ -48,5 +48,10 @@ AUTOMAKE_VER =  1.9
: CONFIGURE_ENV =   AUTOCONF_VERSION=${AUTOCONF_VER} \
:   AUTOMAKE_VERSION=${AUTOMAKE_VER} \
:   CPPFLAGS=-I${LOCALBASE}/include
:+
:+.include 
:+.if ${PROPERTIES:Mclang}
:+CXXFLAGS +=   -Wno-c++11-narrowing -Wno-deprecated-register
:+.endif
: 
: .include 
:Index: patches/patch-Source_Files_Misc_sdl_dialogs_cpp
:===
:RCS file: patches/patch-Source_Files_Misc_sdl_dialogs_cpp
:diff -N patches/patch-Source_Files_Misc_sdl_dialogs_cpp
:--- /dev/null  1 Jan 1970 00:00:00 -
:+++ patches/patch-Source_Files_Misc_sdl_dialogs_cpp20 Apr 2018 00:46:12 
-
:@@ -0,0 +1,14 @@
:+$OpenBSD$
:+
:+Index: Source_Files/Misc/sdl_dialogs.cpp
:+--- Source_Files/Misc/sdl_dialogs.cpp.orig
: Source_Files/Misc/sdl_dialogs.cpp
:+@@ -2018,7 +2018,7 @@ void tab_placer::visible(bool visible)
:+ 
:+ dialog::dialog() : active_widget(NULL), mouse_widget(0), 
active_widget_num(UNONE), done(false),
:+ cursor_was_visible(false), parent_dialog(NULL),
:+-processing_function(NULL), placer(0), last_redraw(0)
:++processing_function(0), placer(0), last_redraw(0)
:+ {
:+ }
:+ 
:Index: patches/patch-Source_Files_Misc_sdl_widgets_cpp
:===
:RCS file: patches/patch-Source_Files_Misc_sdl_widgets_cpp
:diff -N patches/patch-Source_Files_Misc_sdl_widgets_cpp
:--- /dev/null  1 Jan 1970 00:00:00 -
:+++ patches/patch-Source_Files_Misc_sdl_widgets_cpp20 Apr 2018 00:46:12 
-
:@@ -0,0 +1,32 @@
:+$OpenBSD$
:+
:+Index: Source_Files/Misc/sdl_widgets.cpp
:+--- Source_Files/Misc/sdl_widgets.cpp.orig
: Source_Files/Misc/sdl_widgets.cpp
:+@@ -719,7 +719,7 @@ void w_select_button::place(const SDL_Rect , placeme
:+ 
:+ static const char* sNoValidOptionsString = "(no valid options)"; // XXX 
should be moved outside compiled code e.g. to MML
:+ 
:+-w_select::w_select(size_t s, const char **l) : widget(LABEL_WIDGET), 
labels(l), we_own_labels(false), selection(s), 
selection_changed_callback(NULL), utf8(false)
:++w_select::w_select(size_t s, const char **l) : widget(LABEL_WIDGET), 
labels(l), we_own_labels(false), selection(s), selection_changed_callback(0), 
utf8(false)
:+ {
:+  num_labels = 0;
:+ if(labels) {
:+@@ -1113,7 +1113,7 @@ void w_color_picker::draw(SDL_Surface *s) const
:+  */
:+ 
:+ w_text_entry::w_text_entry(size_t max_c, const char *initial_text)
:+- : widget(TEXT_ENTRY_WIDGET), enter_pressed_callback(NULL), 
value_changed_callback(NULL), max_chars(max_c), enable_mac_roman(false)
:++ : widget(TEXT_ENTRY_WIDGET), enter_pressed_callback(0), 
value_changed_callback(0), max_chars(max_c), enable_mac_roman(false)
:+ {
:+  // Initialize buffer
:+  buf = new char[max_chars + 1];
:+@@ -2115,7 +2115,7 @@ void w_select_popup::gotSelected ()
:+ static const char* const sFileChooserInvalidFileString = "(no valid 

Re: clang 6 deregister games/alephone/alephone

2018-04-19 Thread Ingo Schwarze
Hi,

Christian Weisgerber wrote on Wed, Apr 18, 2018 at 01:18:22PM +0200:
> Peter Hessler:

>> This patch set removes the "register" keyword, which is no longer
>> legal to use.

> Why bother?  It doesn't cause errors, just warnings.
> Instead of patches, I would suggest defining it away by adding
> -Dregister= to CXXFLAGS.

My impression is that -Wno-deprecated-register might be even safer
because it doesn't blindly change the code but just hide the
warnings.

The following patch fixes the problems that must be fixed to build
with clang6.  They are all related to the well-known clang6 effect
that NULL cannot be assigned to certain pointer types, in this
case function pointers.

The flag -Wno-c++11-narrowing is *really* required.  There are
many dozen, maybe hundreds of violations scattered all over the
place.  I suspect that some of them may actually be overflow bugs
and result in rendering errors (or worse), but auditing for that
is really a task for upstream, not for us (unless the MAINTAINER
is extremely bored :).

No, i'm not gonna get addicted to this game.  Testing it feels like
brutal work.  It runs for me, and so do i.  But we want to get the
tree back in shape, right?

OK?
  Ingo


Index: Makefile
===
RCS file: /cvs/ports/games/alephone/alephone/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- Makefile26 Jul 2017 22:45:20 -  1.23
+++ Makefile20 Apr 2018 00:46:12 -
@@ -6,7 +6,7 @@ COMMENT =   open source game engine based
 DATE = 20150620
 DISTNAME = AlephOne-${DATE}
 PKGNAME =  alephone-1.2.1
-REVISION = 0
+REVISION = 1
 
 EXTRACT_SUFX = .tar.bz2
 CATEGORIES =   games x11
@@ -48,5 +48,10 @@ AUTOMAKE_VER =   1.9
 CONFIGURE_ENV =AUTOCONF_VERSION=${AUTOCONF_VER} \
AUTOMAKE_VERSION=${AUTOMAKE_VER} \
CPPFLAGS=-I${LOCALBASE}/include
+
+.include 
+.if ${PROPERTIES:Mclang}
+CXXFLAGS +=-Wno-c++11-narrowing -Wno-deprecated-register
+.endif
 
 .include 
Index: patches/patch-Source_Files_Misc_sdl_dialogs_cpp
===
RCS file: patches/patch-Source_Files_Misc_sdl_dialogs_cpp
diff -N patches/patch-Source_Files_Misc_sdl_dialogs_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Source_Files_Misc_sdl_dialogs_cpp 20 Apr 2018 00:46:12 
-
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: Source_Files/Misc/sdl_dialogs.cpp
+--- Source_Files/Misc/sdl_dialogs.cpp.orig
 Source_Files/Misc/sdl_dialogs.cpp
+@@ -2018,7 +2018,7 @@ void tab_placer::visible(bool visible)
+ 
+ dialog::dialog() : active_widget(NULL), mouse_widget(0), 
active_widget_num(UNONE), done(false),
+ cursor_was_visible(false), parent_dialog(NULL),
+- processing_function(NULL), placer(0), last_redraw(0)
++ processing_function(0), placer(0), last_redraw(0)
+ {
+ }
+ 
Index: patches/patch-Source_Files_Misc_sdl_widgets_cpp
===
RCS file: patches/patch-Source_Files_Misc_sdl_widgets_cpp
diff -N patches/patch-Source_Files_Misc_sdl_widgets_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Source_Files_Misc_sdl_widgets_cpp 20 Apr 2018 00:46:12 
-
@@ -0,0 +1,32 @@
+$OpenBSD$
+
+Index: Source_Files/Misc/sdl_widgets.cpp
+--- Source_Files/Misc/sdl_widgets.cpp.orig
 Source_Files/Misc/sdl_widgets.cpp
+@@ -719,7 +719,7 @@ void w_select_button::place(const SDL_Rect , placeme
+ 
+ static const char* sNoValidOptionsString = "(no valid options)"; // XXX 
should be moved outside compiled code e.g. to MML
+ 
+-w_select::w_select(size_t s, const char **l) : widget(LABEL_WIDGET), 
labels(l), we_own_labels(false), selection(s), 
selection_changed_callback(NULL), utf8(false)
++w_select::w_select(size_t s, const char **l) : widget(LABEL_WIDGET), 
labels(l), we_own_labels(false), selection(s), selection_changed_callback(0), 
utf8(false)
+ {
+   num_labels = 0;
+ if(labels) {
+@@ -1113,7 +1113,7 @@ void w_color_picker::draw(SDL_Surface *s) const
+  */
+ 
+ w_text_entry::w_text_entry(size_t max_c, const char *initial_text)
+-  : widget(TEXT_ENTRY_WIDGET), enter_pressed_callback(NULL), 
value_changed_callback(NULL), max_chars(max_c), enable_mac_roman(false)
++  : widget(TEXT_ENTRY_WIDGET), enter_pressed_callback(0), 
value_changed_callback(0), max_chars(max_c), enable_mac_roman(false)
+ {
+   // Initialize buffer
+   buf = new char[max_chars + 1];
+@@ -2115,7 +2115,7 @@ void w_select_popup::gotSelected ()
+ static const char* const sFileChooserInvalidFileString = "(no valid 
selection)";
+ 
+ w_file_chooser::w_file_chooser(const char* inDialogPrompt, Typecode 
inTypecode)
+-  : w_select_button("", NULL, NULL, true), typecode(inTypecode)
++  : w_select_button("", 0, NULL, 

Re: clang 6 deregister games/alephone/alephone

2018-04-18 Thread Christian Weisgerber
Peter Hessler:

> This patch set removes the "register" keyword, which is no longer legal
> to use.

Why bother?  It doesn't cause errors, just warnings.
Instead of patches, I would suggest defining it away by adding
-Dregister= to CXXFLAGS.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



clang 6 deregister games/alephone/alephone

2018-04-18 Thread Peter Hessler
This patch set removes the "register" keyword, which is no longer legal
to use.

There is still a failure, involving Boost and a Null function pointer:

...
In file included from csalerts_sdl.cpp:37:
In file included from ../../Source_Files/Misc/sdl_dialogs.h:33:
In file included from /usr/local/include/boost/function.hpp:70:
In file included from 
/usr/local/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:47:
In file included from 
/usr/local/include/boost/function/detail/function_iterate.hpp:14:
In file included from 
/usr/local/include/boost/function/detail/maybe_include.hpp:15:
/usr/local/include/boost/function/function_template.hpp:159:33: error: called
  object type 'nullptr_t' is not a function or function pointer
  BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^~~~
/usr/local/include/boost/function/function_template.hpp:81:36: note: expanded
  from macro 'BOOST_FUNCTION_RETURN'
#  define BOOST_FUNCTION_RETURN(X) X
   ^
/usr/local/include/boost/function/function_template.hpp:925:53: note: in
  instantiation of member function
  'boost::detail::function::void_function_obj_invoker0::invoke' requested here
{ { _type::manage }, _type::invoke };
^
/usr/local/include/boost/function/function_template.hpp:716:13: note: in
  instantiation of function template specialization
  'boost::function0::assign_to' requested here
  this->assign_to(f);
^
/usr/local/include/boost/function/function_template.hpp:1061:5: note: in
  instantiation of function template specialization
  'boost::function0::function0' requested here
base_type(f)
^
../../Source_Files/Misc/sdl_widgets.h:1082:5: note: in instantiation of function
  template specialization 'boost::function::function'
  requested here
, m_callback (NULL)
  ^
1 error generated.
gmake[3]: *** [Makefile:403: csalerts_sdl.o] Error 1
gmake[3]: Leaving directory 
'/usr/obj/alephone-1.2.1/AlephOne-20150620/Source_Files/CSeries'
...

While here, remove patches/patch-Source_Files_Sound_SoundManager_cpp
which added a header that is already included.

OK to make partial progress?


Index: patches/patch-Source_Files_GameWorld_map_cpp
===
RCS file: patches/patch-Source_Files_GameWorld_map_cpp
diff -N patches/patch-Source_Files_GameWorld_map_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Source_Files_GameWorld_map_cpp16 Apr 2018 15:27:50 
-
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: Source_Files/GameWorld/map.cpp
+--- Source_Files/GameWorld/map.cpp.orig
 Source_Files/GameWorld/map.cpp
+@@ -1015,7 +1015,7 @@ void get_object_shape_and_transfer_mode(
+   struct shape_and_transfer_mode *data)
+ {
+   struct object_data *object= get_object_data(object_index);
+-  register struct shape_animation_data *animation;
++  struct shape_animation_data *animation;
+   angle theta;
+   short view;
+   
+@@ -1138,7 +1138,7 @@ bool randomize_object_sequence(
+   shape_descriptor shape)
+ {
+   struct object_data *object= get_object_data(object_index);
+-  register struct shape_animation_data *animation;
++  struct shape_animation_data *animation;
+   bool randomized= false;
+   
+   animation= get_shape_animation_data(shape);
Index: patches/patch-Source_Files_GameWorld_world_cpp
===
RCS file: patches/patch-Source_Files_GameWorld_world_cpp
diff -N patches/patch-Source_Files_GameWorld_world_cpp
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Source_Files_GameWorld_world_cpp  16 Apr 2018 15:27:50 
-
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+Index: Source_Files/GameWorld/world.cpp
+--- Source_Files/GameWorld/world.cpp.orig
 Source_Files/GameWorld/world.cpp
+@@ -260,7 +260,7 @@ static angle m2_arctangent(
+   world_distance y = yy;
+ 
+   long tangent;
+-  register long last_difference, new_difference;
++  long last_difference, new_difference;
+   angle search_arc, theta;
+   
+   if (x)
+@@ -618,10 +618,9 @@ world_distance distance2d(
+  *  r++;
+  */
+ 
+-int32 isqrt(
+-  register uint32 x)
++int32 isqrt(uint32 x)
+ {
+-  register uint32 r, nr, m;
++  uint32 r, nr, m;
+ 
+   r= 0;
+   m= 0x4000;
Index: patches/patch-Source_Files_GameWorld_world_h
===
RCS file: patches/patch-Source_Files_GameWorld_world_h
diff -N patches/patch-Source_Files_GameWorld_world_h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Source_Files_GameWorld_world_h16 Apr 2018 15:27:50 
-
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: Source_Files/GameWorld/world.h
+--- Source_Files/GameWorld/world.h.orig