Bug #85298 item_geofunc.cc:1887:49: warning: enum constant in boolean context

Submitted: 3 Mar 2017 17:27 Modified: 24 May 2017 10:55
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: GIS Severity:S3 (Non-critical)
Version:5.7+ OS:Any
Assigned to: CPU Architecture:Any

[3 Mar 2017 17:27] Shane Bester
Description:
look here:

https://github.com/mysql/mysql-server/blob/5.7/sql/item_geofunc.cc#L1869

if (header.wkb_type == Geometry::wkb_multipoint)
...
 else if (header.wkb_type == Geometry::wkb_multipolygon)
...
else if (Geometry::wkb_multilinestring)
...
else
....

Looks like a typo in the last 'else if' - it'll always be true since it's defined as 5.

./sql/item_geofunc.cc: In function ‘bool append_geometry(Geometry::wkb_parser*, Json_object*, bool, MBR*, const char*, int, bool, bool, bool, uint32)’:
./sql/item_geofunc.cc:1887:49: warning: enum constant in boolean context [-Wint-in-bool-context]
           else if (Geometry::wkb_multilinestring)
 

How to repeat:
read compiler warnings.

Suggested fix:
else if (header.wkb_type == Geometry::wkb_multilinestring)  ????
[24 May 2017 10:55] Erlend Dahl
Duplicate of

Bug#85235 MySQL does not compile with GCC 7
[29 Nov 2017 7:40] Shane Bester
This issue was also reported independently in this blog post:
https://www.viva64.com/en/b/0542/

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.