Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Apr 2015 16:39:18 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r384240 - in head/games/netradiant: . files
Message-ID:  <201504181639.t3IGdIxc037821@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Sat Apr 18 16:39:18 2015
New Revision: 384240
URL: https://svnweb.freebsd.org/changeset/ports/384240

Log:
  - Clang insists that reference cannot be bound to dereferenced null pointer
    in well-defined C++ code (that is correct) and evaluates comparisons like
    &foo == 0 to false, which breaks NetRadiant; "fix" this with a dirty hack
    by casting those "bad" references to a local volatile int variable (since
    NetRadiant is based on GtkRadiant 1.5 codebase, this is the same bug that
    was fixed in r384239; patches are slightly different though)
  - While here, make a comment more accurate, and bump port revision

Added:
  head/games/netradiant/files/patch-radiant_treemodel.cpp   (contents, props changed)
Modified:
  head/games/netradiant/Makefile

Modified: head/games/netradiant/Makefile
==============================================================================
--- head/games/netradiant/Makefile	Sat Apr 18 16:29:01 2015	(r384239)
+++ head/games/netradiant/Makefile	Sat Apr 18 16:39:18 2015	(r384240)
@@ -3,7 +3,7 @@
 
 PORTNAME=	netradiant
 PORTVERSION=	20130630
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	games cad
 MASTER_SITES=	http://ingar.satgnu.net/gtkradiant/files/ \
 		http://freebsd.nsu.ru/distfiles/
@@ -48,7 +48,7 @@ pre-install:
 # Fix permissions of some files (drop bogus execute bit)
 	@${FIND} ${WRKSRC}/install/osirion.game -type f | ${XARGS} ${CHMOD} a-x
 	@${CHMOD} a-x ${WRKSRC}/install/games/osirion.game
-# Remove extra copy of GNU GPL from what we install
+# Remove a copy of GNU GPL from what we are going to install
 	@${RM} ${WRKSRC}/install/GPL.txt
 
 do-install:

Added: head/games/netradiant/files/patch-radiant_treemodel.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/netradiant/files/patch-radiant_treemodel.cpp	Sat Apr 18 16:39:18 2015	(r384240)
@@ -0,0 +1,56 @@
+--- radiant/treemodel.cpp.orig	2013-06-30 14:04:35 UTC
++++ radiant/treemodel.cpp
+@@ -647,7 +647,12 @@ void detach( const NameCallback& callbac
+ };
+ 
+ void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
+-	if ( &node != 0 ) {
++	// Reference cannot be bound to dereferenced null pointer in a
++	// well-defined C++ code, and Clang will assume that comparison
++	// below always evaluates to true, resulting in segmentation
++	// fault.  Use a dirty hack to force Clang to check for null.
++	volatile int n = (int)&node;
++	if ( n != 0 ) {
+ 		Nameable* nameable = Node_getNameable( node );
+ 		if ( nameable != 0 ) {
+ 			nameable->attach( callback );
+@@ -655,7 +660,8 @@ void node_attach_name_changed_callback( 
+ 	}
+ }
+ void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
+-	if ( &node != 0 ) {
++	volatile int n = (int)&node;	// see the comment on line 650
++	if ( n != 0 ) {
+ 		Nameable* nameable = Node_getNameable( node );
+ 		if ( nameable != 0 ) {
+ 			nameable->detach( callback );
+@@ -1124,7 +1130,8 @@ void graph_tree_model_row_deleted( Graph
+ const char* node_get_name( scene::Node& node );
+ 
+ const char* node_get_name_safe( scene::Node& node ){
+-	if ( &node == 0 ) {
++	volatile int n = (int)&node;	// see the comment on line 650
++	if ( n == 0 ) {
+ 		return "";
+ 	}
+ 	return node_get_name( node );
+@@ -1142,7 +1149,8 @@ GraphTreeNode* graph_tree_model_find_par
+ }
+ 
+ void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
+-	if ( &node != 0 ) {
++	volatile int n = (int)&node;	// see the comment on line 650
++	if ( n != 0 ) {
+ 		Nameable* nameable = Node_getNameable( node );
+ 		if ( nameable != 0 ) {
+ 			nameable->attach( callback );
+@@ -1150,7 +1158,8 @@ void node_attach_name_changed_callback( 
+ 	}
+ }
+ void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){
+-	if ( &node != 0 ) {
++	volatile int n = (int)&node;	// see the comment on line 650
++	if ( n != 0 ) {
+ 		Nameable* nameable = Node_getNameable( node );
+ 		if ( nameable != 0 ) {
+ 			nameable->detach( callback );



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504181639.t3IGdIxc037821>