--- /dev/null
+From fe19b7b6016d446722621fb407738209d1a911e8 Mon Sep 17 00:00:00 2001
+From: Harry Wong <harrywong@live.com>
+Date: Thu, 4 May 2017 10:08:48 +0800
+Subject: [PATCH 1/2] Supress implicit fallthrough in GCC
+
+---
+ include/rapidjson/internal/regex.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
+index 1369ea266..6d110bdbd 100644
+--- a/include/rapidjson/internal/regex.h
++++ b/include/rapidjson/internal/regex.h
+@@ -29,6 +29,7 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
+ #ifdef __GNUC__
+ RAPIDJSON_DIAG_PUSH
+ RAPIDJSON_DIAG_OFF(effc++)
++RAPIDJSON_DIAG_OFF(implicit-fallthrough)
+ #endif
+
+ #ifdef _MSC_VER
+
+From cba45fe9de6923b858edb0780e257b7257aa4f7b Mon Sep 17 00:00:00 2001
+From: Harry Wong <harrywong@live.com>
+Date: Thu, 4 May 2017 10:32:45 +0800
+Subject: [PATCH 2/2] Onley apply to GCC 7
+
+---
+ include/rapidjson/internal/regex.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
+index 6d110bdbd..e1a2faae5 100644
+--- a/include/rapidjson/internal/regex.h
++++ b/include/rapidjson/internal/regex.h
+@@ -29,8 +29,10 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
+ #ifdef __GNUC__
+ RAPIDJSON_DIAG_PUSH
+ RAPIDJSON_DIAG_OFF(effc++)
++#if __GNUC__ >= 7
+ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
+ #endif
++#endif
+
+ #ifdef _MSC_VER
+ RAPIDJSON_DIAG_PUSH
--- /dev/null
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils
+
+DESCRIPTION="A fast JSON parser/generator for C++ with both SAX/DOM style API"
+HOMEPAGE="http://rapidjson.org/"
+
+LICENSE="MIT"
+IUSE="doc examples test"
+SLOT="0"
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/miloyip/rapidjson.git"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/miloyip/rapidjson/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ S="${WORKDIR}/rapidjson-${PV}"
+fi
+
+DEPEND="
+ doc? ( app-doc/doxygen )
+ test? (
+ dev-cpp/gtest
+ dev-util/valgrind
+ )"
+RDEPEND=""
+
+PATCHES=(
+ "${FILESDIR}/${P}-gcc-7.patch"
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DRAPIDJSON_BUILD_DOC=$(usex doc)
+ -DRAPIDJSON_BUILD_EXAMPLES=$(usex examples)
+ -DRAPIDJSON_BUILD_TESTS=$(usex test)
+ -DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF
+ )
+ cmake-utils_src_configure
+}