Module: check_mk
Branch: master
Commit: a975378ed57a8d3f829b0f626319b7cc77b0eefe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a975378ed57a8d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Feb 9 15:23:24 2018 +0100
Patch for RE2: Use fallthrough attribute when available.
We should probably upstream this...
Change-Id: I9b98d74b9c13638b93d1c62ce4f4bc84c1c97599
---
omd/packages/re2/Makefile | 12 ++++++--
...-Use-fallthrough-attribute-when-available.patch | 33 ++++++++++++++++++++++
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/omd/packages/re2/Makefile b/omd/packages/re2/Makefile
index 2a7c9a0..832fe82 100644
--- a/omd/packages/re2/Makefile
+++ b/omd/packages/re2/Makefile
@@ -7,10 +7,9 @@ NAME = re2
VERSION = 2018-02-01
DIR = $(NAME)-$(VERSION)
-.PHONY: build install skel clean
+.PHONY: build unpacks install skel clean
-build:
- tar xzf $(DIR).tar.gz
+build: unpack
# basically what part of AC_PROC_CXX does
@CXX="" ; \
for PROG in g++-7 clang++-5.0 g++-6 clang++-4.0 g++-5 clang++-3.9 clang++-3.8
clang++-3.7 clang++-3.6 clang++-3.5 g++-4.9 g++ clang++; do \
@@ -32,6 +31,13 @@ build:
# The RE2 Makefile offers no mechanism to strip the libraries. :-/
strip $(PACKAGE_RE2_DESTDIR)/lib/*.a $(PACKAGE_RE2_DESTDIR)/lib/*.so
+unpack:
+ tar xzf $(DIR).tar.gz
+ for p in patches/*.patch; do \
+ echo "applying $$p..." ; \
+ patch -p1 -b -d $(DIR) < $$p ; \
+ done
+
install:
mkdir -p $(DESTDIR)$(OMD_ROOT)
cp -a $(PACKAGE_RE2_DESTDIR)/include $(PACKAGE_RE2_DESTDIR)/lib $(DESTDIR)$(OMD_ROOT)
diff --git a/omd/packages/re2/patches/0001-Use-fallthrough-attribute-when-available.patch
b/omd/packages/re2/patches/0001-Use-fallthrough-attribute-when-available.patch
new file mode 100644
index 0000000..8fa9726
--- /dev/null
+++ b/omd/packages/re2/patches/0001-Use-fallthrough-attribute-when-available.patch
@@ -0,0 +1,33 @@
+From ef0b0e0bde7bb50b6b5d6144a53869bfc2416597 Mon Sep 17 00:00:00 2001
+From: Sven Panne <sp(a)mathias-kettner.de>
+Date: Fri, 9 Feb 2018 15:12:37 +0100
+Subject: [PATCH] Use fallthrough attribute when available.
+
+---
+ util/util.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/util/util.h b/util/util.h
+index a69d842..9f8216b 100644
+--- a/util/util.h
++++ b/util/util.h
+@@ -11,6 +11,16 @@ using std::string;
+
+ #define arraysize(array) (int)(sizeof(array)/sizeof((array)[0]))
+
++#if !defined(FALLTHROUGH_INTENDED) && defined(__has_cpp_attribute)
++#if __has_cpp_attribute(fallthrough)
++#define FALLTHROUGH_INTENDED [[fallthrough]]
++#elif __has_cpp_attribute(gnu::fallthrough)
++#define FALLTHROUGH_INTENDED [[gnu::fallthrough]]
++#elif __has_cpp_attribute(clang::fallthrough)
++#define FALLTHROUGH_INTENDED [[clang::fallthrough]]
++#endif
++#endif
++
+ #ifndef FALLTHROUGH_INTENDED
+ #define FALLTHROUGH_INTENDED do { } while (0)
+ #endif
+--
+2.14.1
+