re2/SOURCES/re2-compiler-flag-fix.patch

71 lines
2.5 KiB
Diff

From a022cc0c55b0519629d64d775e7a5195af34a477 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
Date: Sun, 16 Jan 2022 10:16:32 -0400
Subject: [PATCH] Don't specify the `-std` flag in Makefile or re2.pc.
As Frank Heckenbach notes in https://bugs.debian.org/1003482:
> re2.pc contains "-std=c++11". This conflicts with other "-std"
> options, especially if one wants to use a newer standard (which
> otherwise works with libre2, as indicated by its support for
> string_view, e.g.).
>
> In order to make sure it's used only with C++11 or newer, you may
> want to check __cplusplus in the header instead.
As gcc and clang default to C++ standards greater than 11, these days,
we can use with the default, rather than the older standard.
Fixes #352.
Change-Id: I1b078df54f583e0b980e1b6341c6d401c8c9d937
Reviewed-on: https://code-review.googlesource.com/c/re2/+/59570
Reviewed-by: Paul Wankadia <junyer@google.com>
---
Makefile | 6 +++---
re2.pc | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index ab67ad03..c7c8145e 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CXX?=g++
CXXFLAGS?=-O3 -g
LDFLAGS?=
# required
-RE2_CXXFLAGS?=-std=c++11 -pthread -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -I. $(CCICU) $(CCPCRE)
+RE2_CXXFLAGS?=-pthread -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -I. $(CCICU) $(CCPCRE)
RE2_LDFLAGS?=-pthread $(LDICU) $(LDPCRE)
AR?=ar
ARFLAGS?=rsc
@@ -327,7 +327,7 @@ testinstall: static-testinstall shared-testinstall
@echo
.PHONY: static-testinstall
-static-testinstall: CXXFLAGS:=-std=c++11 -pthread -I$(DESTDIR)$(includedir) $(CXXFLAGS)
+static-testinstall: CXXFLAGS:=-pthread -I$(DESTDIR)$(includedir) $(CXXFLAGS)
static-testinstall: LDFLAGS:=-pthread -L$(DESTDIR)$(libdir) -l:libre2.a $(LDICU) $(LDFLAGS)
static-testinstall:
@mkdir -p obj
@@ -342,7 +342,7 @@ else
endif
.PHONY: shared-testinstall
-shared-testinstall: CXXFLAGS:=-std=c++11 -pthread -I$(DESTDIR)$(includedir) $(CXXFLAGS)
+shared-testinstall: CXXFLAGS:=-pthread -I$(DESTDIR)$(includedir) $(CXXFLAGS)
shared-testinstall: LDFLAGS:=-pthread -L$(DESTDIR)$(libdir) -lre2 $(LDICU) $(LDFLAGS)
shared-testinstall:
@mkdir -p obj
diff --git a/re2.pc b/re2.pc
index 50fd637d..a590ab8e 100644
--- a/re2.pc
+++ b/re2.pc
@@ -4,5 +4,5 @@ libdir=@libdir@
Name: re2
Description: RE2 is a fast, safe, thread-friendly regular expression engine.
Version: 0.0.0
-Cflags: -std=c++11 -pthread -I${includedir}
+Cflags: -pthread -I${includedir}
Libs: -pthread -L${libdir} -lre2