Bug 220388

Summary: devel/rapidjson: Fix warnings with clang & libc++ 5.0.0
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: tcberner, tobik, yuri
Priority: --- Flags: bugzilla: maintainer-feedback? (yuri)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 219139    
Attachments:
Description Flags
Fix and suppress clang 5.0.0 warnings in devel/rapidjson none

Description Dimitry Andric freebsd_committer freebsd_triage 2017-06-30 17:27:16 UTC
Created attachment 183947 [details]
Fix and suppress clang 5.0.0 warnings in devel/rapidjson

During an exp-run for the projects/clang500-import branch (bug 219139), it turned out that devel/rapidjson does not build with clang and libc++ 5.0.0 [1]:

In file included from /wrkdirs/usr/ports/devel/rapidjson/work/rapidjson-1.1.0/example/tutorial/tutorial.cpp:4:
In file included from /wrkdirs/usr/ports/devel/rapidjson/work/rapidjson-1.1.0/include/rapidjson/document.h:20:
In file included from /wrkdirs/usr/ports/devel/rapidjson/work/rapidjson-1.1.0/include/rapidjson/reader.h:20:
/wrkdirs/usr/ports/devel/rapidjson/work/rapidjson-1.1.0/include/rapidjson/allocators.h:111:64: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]
        chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(0), baseAllocator_(baseAllocator), ownBaseAllocator_(0)
                                                               ^
                                                               nullptr

and many more of these.  The port is built with -Werror and a lot of extra warnings enabled, and clang 5.0.0 now has a new warning about using zero as a null pointer constant (I think it is enabled when you use -std=c++11 or higher).

It is probably easiest to suppress this warning, since fixing all the instances is quite intrusive.  Here is a patch to do just that, and one additional fix for another -Werror warning:

In file included from example/schemavalidator/schemavalidator.cpp:7:
include/rapidjson/schema.h:382:56: error: declaration shadows a typedef in 'Schema<SchemaDocumentType>' [-Werror,-Wshadow]
        typedef typename SchemaDocumentType::ValueType ValueType;
                                                       ^
include/rapidjson/schema.h:340:52: note: previous declaration is here
    typedef typename SchemaDocumentType::ValueType ValueType;
                                                   ^

[1] http://package18.nyi.freebsd.org/data/headamd64PR219139-default/2017-05-22_13h01m42s/logs/errors/rapidjson-1.1.0_1.log
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2017-06-30 21:47:22 UTC
The upstream bug report: https://github.com/miloyip/rapidjson/issues/1003
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2017-06-30 21:54:20 UTC
If they they patch the upstream in a day or two, I will just move the revision of the port.
Comment 3 Tobias C. Berner freebsd_committer freebsd_triage 2017-10-07 16:22:14 UTC
(In reply to Yuri Victorovich from comment #2)
Any news on this -- this leads to build errors for me now.

mfg Tobias
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2017-10-07 19:22:49 UTC
I asked the upstream maintainer in the upstream bug report.
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2017-10-15 03:56:58 UTC
Upstream maintainer asked for a PR.
Comment 6 Tobias Kortkamp freebsd_committer freebsd_triage 2017-12-23 20:52:32 UTC
Ping.

Can we do something about this please?  Maybe apply Dimitry's patch or disable the use of
-Werror entirely?

This blocks having a 12.0-CURRENT package for kodi-devel on pkg.FreeBSD.org.

Thank you.
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2017-12-31 17:14:16 UTC
Committed, thanks!
Comment 8 commit-hook freebsd_committer freebsd_triage 2017-12-31 17:14:56 UTC
A commit references this bug:

Author: yuri
Date: Sun Dec 31 17:14:15 UTC 2017
New revision: 457707
URL: https://svnweb.freebsd.org/changeset/ports/457707

Log:
  devel/rapidjson: Fix clang warnings on 12

  PR:		220388
  Submitted by:	dim
  Approved by:	tcberner (mentor)
  Differential Revision:	https://reviews.freebsd.org/D13599

Changes:
  head/devel/rapidjson/Makefile
  head/devel/rapidjson/distinfo
  head/devel/rapidjson/files/
  head/devel/rapidjson/files/patch-include_rapidjson_schema.h