Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-04-08 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  closed
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:  fixed
 Keywords:  |
+---

Comment (by Sandro Santilli ):

 In [changeset:"9c7b8936d51ceb4f25935a14aecfe3a640701beb/git" 9c7b893/git]:
 {{{
 #!CommitTicketReference repository="git"
 revision="9c7b8936d51ceb4f25935a14aecfe3a640701beb"
 Add static_assert to strings inside of assert calls

 Allows compiling with -Wpointer-bool-conversion.

 Patch by Kurt Schwehr 
 Closes #638

 git-svn-id: http://svn.osgeo.org/geos/trunk@4331 5242fede-
 7e19-0410-aef8-94bd7d2200fb
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-04-08 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  closed
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:  fixed
 Keywords:  |
+---

Comment (by Sandro Santilli ):

 In [changeset:"9c7b8936d51ceb4f25935a14aecfe3a640701beb/git" 9c7b893/git]:
 {{{
 #!CommitTicketReference repository="git"
 revision="9c7b8936d51ceb4f25935a14aecfe3a640701beb"
 Add static_assert to strings inside of assert calls

 Allows compiling with -Wpointer-bool-conversion.

 Patch by Kurt Schwehr 
 Closes #638

 git-svn-id: http://svn.osgeo.org/geos/trunk@4331 5242fede-
 7e19-0410-aef8-94bd7d2200fb
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-04-08 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  closed
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:  fixed
 Keywords:  |
+---

Comment (by Sandro Santilli ):

 In [changeset:"9c7b8936d51ceb4f25935a14aecfe3a640701beb/git" 9c7b893/git]:
 {{{
 #!CommitTicketReference repository="git"
 revision="9c7b8936d51ceb4f25935a14aecfe3a640701beb"
 Add static_assert to strings inside of assert calls

 Allows compiling with -Wpointer-bool-conversion.

 Patch by Kurt Schwehr 
 Closes #638

 git-svn-id: http://svn.osgeo.org/geos/trunk@4331 5242fede-
 7e19-0410-aef8-94bd7d2200fb
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-02-01 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  closed
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:  fixed
 Keywords:  |
+---
Changes (by strk):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"4331" 4331]:
 {{{
 #!CommitTicketReference repository="" revision="4331"
 Add static_assert to strings inside of assert calls

 Allows compiling with -Wpointer-bool-conversion.

 Patch by Kurt Schwehr 
 Closes #638
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-02-01 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  closed
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:  fixed
 Keywords:  |
+---

Comment (by strk):

 In [changeset:"4332" 4332]:
 {{{
 #!CommitTicketReference repository="" revision="4332"
 Add static_assert to strings inside of assert calls

 Allows compiling with -Wpointer-bool-conversion.

 Patch by Kurt Schwehr 
 Closes #638
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by goatbar):

 Ah, I'm building in a world with -Wpointer-bool-conversion enabled.

 http://stackoverflow.com/questions/35797295/clang-how-to-disable-werror-
 wpointer-bool-conversion

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by goatbar):

 mloskot: Can you please explain and give a reference why `!!!""` is
 equivalent to `!static_cast("")`?  I've never seen that in C++ for C
 strings.

 If I try `!!!` in C++11/14, I get the same type of error:

 {{{
 src/operation/union/CascadedUnion.cpp:119:23: error: implicit conversion
 turns string literal into bool: 'const char [24]' to 'bool' [-Werror
 ,-Wstring-conversion]
 assert(!!!"should never be reached");
 }}}

 I found this for *javascript* http://stackoverflow.com/questions/21154510
 /the-use-of-the-triple-exclamation-mark

 https://cboard.cprogramming.com/c-programming/133581-what-double-
 exclamation-mark-c-language.html#post994202

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by mloskot):

 To me, the cast looks, well, unfitting.

 Why not to use conversion to bool, pretty idiomatic

 {{{
 assert(!!!"SHOULD NEVER GET HERE");
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by strk):

 You don't necessarely need the github machinery, just a publicly
 accessible
 branch in a git repo you can write to :)

 That said, if you want to use a web UI mediated branch tracking issue
 feel free to use it on any of the available mirrors: github, gitlab or
 gogs
 (the latter lets you use the same account you're using to write here).

 See wiki:CodeRepository (blindly trying the TracLink)

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by goatbar):

 You can tell track to format a block of text.  e.g. I did `{{{#!patch`

 I can clone the repo and do a pull request.  I haven't used request-pull
 before.  Thanks for the pointer to https://git-scm.com/docs/git-request-
 pull

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by strk):

 How did you get trac to format your patches like that ? Do you have a
 publically-reachable git repository to fetch your changes from ? See {{{
 git request-pull }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2017-01-31 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.7.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---

Comment (by goatbar):

 Ping.  I just had to remerge 3.6.1 downstream.  Here is my patch:

 {{{#!diff
 diff --git a/geos/geos-3.6.1/src/geom/util/GeometryEditor.cpp
 b/geos/geos-3.6.1/src/geom/util/GeometryEditor.cpp
 index c70fa1e..0f9b589 100644
 --- a/geos/geos-3.6.1/src/geom/util/GeometryEditor.cpp
 +++ b/geos/geos-3.6.1/src/geom/util/GeometryEditor.cpp
 @@ -99,7 +99,7 @@ GeometryEditor::edit(const Geometry *geometry,
 GeometryEditorOperation *operatio
}

  // Unsupported Geometry classes should be caught in the
 GeometryEditorOperation.
 -assert(!"SHOULD NEVER GET HERE");
 +assert(!static_cast("SHOULD NEVER GET HERE"));
  return NULL;
  }

 diff --git a/geos/geos-3.6.1/src/index/strtree/AbstractSTRtree.cpp
 b/geos/geos-3.6.1/src/index/strtree/AbstractSTRtree.cpp
 index f11401a..84e7a86 100644
 --- a/geos/geos-3.6.1/src/index/strtree/AbstractSTRtree.cpp
 +++ b/geos/geos-3.6.1/src/index/strtree/AbstractSTRtree.cpp
 @@ -370,7 +370,7 @@ ItemsList* AbstractSTRtree::itemsTree(AbstractNode*
 node)
  static_cast(childBoundable)->getItem());
  }
  else {
 -assert(!"should never be reached");
 +assert(!static_cast("should never be reached"));
  }
  }
  if (valuesTreeForNode->empty())
 @@ -395,4 +395,3 @@ ItemsList* AbstractSTRtree::itemsTree()
  } // namespace geos.index.strtree
  } // namespace geos.index
  } // namespace geos
 -
 diff --git a/geos/geos-3.6.1/src/linearref/ExtractLineByLocation.cpp
 b/geos/geos-3.6.1/src/linearref/ExtractLineByLocation.cpp
 index 04b3690..4928da5 100644
 --- a/geos/geos-3.6.1/src/linearref/ExtractLineByLocation.cpp
 +++ b/geos/geos-3.6.1/src/linearref/ExtractLineByLocation.cpp
 @@ -79,7 +79,7 @@ Geometry *ExtractLineByLocation::reverse(const Geometry
 *linear)
 }
 else
 {
 -   assert(!"non-linear geometry encountered");
 +   assert(!!static_cast("non-linear geometry
 encountered"));
  return 0;
 }
 }
 diff --git a/geos/geos-3.6.1/src/operation/union/CascadedPolygonUnion.cpp
 b/geos/geos-3.6.1/src/operation/union/CascadedPolygonUnion.cpp
 index 92ec6da..64e66c7 100644
 --- a/geos/geos-3.6.1/src/operation/union/CascadedPolygonUnion.cpp
 +++ b/geos/geos-3.6.1/src/operation/union/CascadedPolygonUnion.cpp
 @@ -139,7 +139,7 @@
 CascadedPolygonUnion::reduceToGeometries(index::strtree::ItemsList*
 geomTree)
 geoms->push_back(reinterpret_cast((*i).get_geometry()));
  }
  else {
 -assert(!"should never be reached");
 +assert(!static_cast("should never be reached"));
  }
  }

 @@ -247,4 +247,3 @@
 CascadedPolygonUnion::restrictToPolygons(std::auto_ptr g)
  } // namespace geos.operation.union
  } // namespace geos.operation
  } // namespace geos
 -
 diff --git a/geos/geos-3.6.1/src/operation/union/CascadedUnion.cpp
 b/geos/geos-3.6.1/src/operation/union/CascadedUnion.cpp
 index 4bd522a..744dae6 100644
 --- a/geos/geos-3.6.1/src/operation/union/CascadedUnion.cpp
 +++ b/geos/geos-3.6.1/src/operation/union/CascadedUnion.cpp
 @@ -116,7 +116,7 @@
 CascadedUnion::reduceToGeometries(index::strtree::ItemsList* geomTree)
 geoms->push_back(reinterpret_cast((*i).get_geometry()));
  }
  else {
 -assert(!"should never be reached");
 +assert(!static_cast("should never be reached"));
  }
  }

 @@ -195,4 +195,3 @@ CascadedUnion::unionActual(geom::Geometry* g0,
 geom::Geometry* g1)
  } // namespace geos.operation.union
  } // namespace geos.operation
  } // namespace geos
 -
 }}}

--
Ticket URL: 
GEOS 
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2015-07-16 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…
 Type:  defect  |  Status:  new
 Priority:  major   |   Milestone:  3.6.0
Component:  Default | Version:  3.3.8
 Severity:  Unassigned  |  Resolution:
 Keywords:  |
+---
Changes (by robe):

 * milestone:  3.5.0 = 3.6.0


--
Ticket URL: http://trac.osgeo.org/geos/ticket/638#comment:5
GEOS http://trac.osgeo.org/geos
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2013-08-05 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…  
 Type:  defect  |  Status:  new   
 Priority:  major   |   Milestone:
Component:  Default | Version:  3.3.8 
 Severity:  Unassigned  |Keywords:
+---

Comment(by goatbar):

 GCC 4.7.x with numerous patches, but I'm not exactly sure.  This is the
 message I'm getting:
 {{{
 geos-3.3.8/src/geom/util/GeometryEditor.cpp:103:13: error: implicit
 conversion turns string literal into bool: 'const char [22]' to 'bool'
 [-Werror,-Wstring-conversion]
 include/assert.h:92:5: note: expanded from macro 'assert'
 }}}

-- 
Ticket URL: http://trac.osgeo.org/geos/ticket/638#comment:3
GEOS http://geos.refractions.net/
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2013-08-05 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…  
 Type:  defect  |  Status:  new   
 Priority:  major   |   Milestone:  3.5.0 
Component:  Default | Version:  3.3.8 
 Severity:  Unassigned  |Keywords:
+---
Changes (by robe):

  * milestone:  = 3.5.0


Old description:

 I recommend that for all asserts with strings, that they be changed to
 wrap the string in a static_cast.  Not very exciting, but it makes the
 stricter compilers happier.

 e.g. in src/geom/util/GeometryEditor.cpp

 {{{
 assert(!SHOULD NEVER GET HERE);
 }}}

 changes to

 {{{
 assert(!static_castbool(SHOULD NEVER GET HERE));
 }}}

New description:

 I recommend that for all asserts with strings, that they be changed to
 wrap the string in a static_cast.  Not very exciting, but it makes the
 stricter compilers happier.

 e.g. in src/geom/util/GeometryEditor.cpp

 {{{
 assert(!SHOULD NEVER GET HERE);
 }}}

 changes to

 {{{
 assert(!static_castbool(SHOULD NEVER GET HERE));
 }}}

--

Comment:

 Not seeing this particular error on my mingw gcc 4.8 built with cmake.
 Though I do see this somewhat troubling notice


 {{{
 In file included from
 c:/jenkins/geos/branches/3.4cmake/tests/xmltester/BufferResultMatcher.cpp:22:0:
 C:/jenkins/geos/branches/3.4cmake/include/geos/geom/BinaryOp.h: In
 instantiation of 'std::auto_ptrgeos::geom::Geometry
 geos::geom::BinaryOp(const geos::geom::Geometry*, const
 geos::geom::Geometry*, BinOp) [with BinOp =
 geos::operation::overlay::overlayOp]':
 
c:/jenkins/geos/branches/3.4cmake/tests/xmltester/BufferResultMatcher.cpp:80:58:
 required from here
 C:/jenkins/geos/branches/3.4cmake/include/geos/geom/BinaryOp.h:459:32:
 warning: overflow in implicit constant conversion [-Woverflow]
long unsigned int maxScale = 1e16;
 }}}

 I'd just assume avoid these changes in a micro release especially since we
 plan to release soon and sounds like a lot of changes would need to be
 made to accommodate this. Pushing to 3.5

-- 
Ticket URL: http://trac.osgeo.org/geos/ticket/638#comment:4
GEOS http://geos.refractions.net/
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2013-07-18 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…  
 Type:  defect  |  Status:  new   
 Priority:  major   |   Milestone:
Component:  Default | Version:  3.3.8 
 Severity:  Unassigned  |Keywords:
+---

Comment(by goatbar):

 warmerdam suggested:

 Perhaps assertFailureWithMessage(text) that expands to something like this

-- 
Ticket URL: http://trac.osgeo.org/geos/ticket/638#comment:1
GEOS http://geos.refractions.net/
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel

Re: [geos-devel] [GEOS] #638: Recommend a static_cast around assert strings

2013-07-18 Thread GEOS
#638: Recommend a static_cast around assert strings
+---
 Reporter:  goatbar |   Owner:  geos-devel@…  
 Type:  defect  |  Status:  new   
 Priority:  major   |   Milestone:
Component:  Default | Version:  3.3.8 
 Severity:  Unassigned  |Keywords:
+---

Comment(by mloskot):

 I'm curious, what stricter compilers you mean?
 Non of these complain, using strict flags -pedantic -Wall -ansi
 -std=c++11: clang 3.4, gcc 4.8, Intell C/C++ 13.

-- 
Ticket URL: http://trac.osgeo.org/geos/ticket/638#comment:2
GEOS http://geos.refractions.net/
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite 
(JTS).
___
geos-devel mailing list
geos-devel@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel