* Re: [PATCH v1] make: ensure a consistent C++ standard use
2019-01-01 0:00 [PATCH v1] make: ensure a consistent C++ standard use Matthias Maennich via libabigail
@ 2019-01-01 0:00 ` Dodji Seketeli
0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2019-01-01 0:00 UTC (permalink / raw)
To: Matthias Maennich; +Cc: libabigail, kernel-team, Chun-Hung Wu
Hello,
Matthias Maennich <maennich@google.com> a écrit:
> On older compilers (such as g++ 4.8), the default C++ standard is set to
> gnu++98. When compiling libabigail with --enable-cxx11=yes, src/ and
> tests/ where compiled with the correct flag, while tools/ was compiled
> without specifying a standard. With a compiler falling back to gnu++98
> that leads to unresolved references when linking the tools against the
> libabigail library. Fix that by consistently using the std= flag across
> the code base.
>
> * configure.ac: add -std=c++11 flag to CXXFLAGS when compiling
> for C++11
> * src/Makefile.am: drop now obsolete setting of the -std flag
> * tests/Makefile.am: likewise
This looks good to me, so I have pushed it to master.
The only nit I have picked is that I merged the hunk below
> +if test x$ENABLE_CXX11 = xyes; then
> + CXXFLAGS="$CXXFLAGS -std=c++11"
> +fi
with the spot in the configure.ac file where we were already handling
the C++11 enabling. So the change to configure.ac became:
diff --git a/configure.ac b/configure.ac
index afcc1db..44e951f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -545,6 +545,7 @@ AC_SUBST(DEPS_CPPFLAGS)
dnl Handle conditional use of a C++11 compiler
if test x$ENABLE_CXX11 = xyes; then
+ CXXFLAGS="$CXXFLAGS -std=c++11"
AC_DEFINE([WITH_CXX11], 1, [Defined to 1 if a C++11 compiler is used])
fi
Thanks a lot for taking the time to prepare this patch!
Cheers,
--
Dodji
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v1] make: ensure a consistent C++ standard use
@ 2019-01-01 0:00 Matthias Maennich via libabigail
2019-01-01 0:00 ` Dodji Seketeli
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Maennich via libabigail @ 2019-01-01 0:00 UTC (permalink / raw)
To: libabigail; +Cc: dodji, kernel-team, Matthias Maennich, Chun-Hung Wu
On older compilers (such as g++ 4.8), the default C++ standard is set to
gnu++98. When compiling libabigail with --enable-cxx11=yes, src/ and
tests/ where compiled with the correct flag, while tools/ was compiled
without specifying a standard. With a compiler falling back to gnu++98
that leads to unresolved references when linking the tools against the
libabigail library. Fix that by consistently using the std= flag across
the code base.
* configure.ac: add -std=c++11 flag to CXXFLAGS when compiling
for C++11
* src/Makefile.am: drop now obsolete setting of the -std flag
* tests/Makefile.am: likewise
Reported-by: Chun-Hung Wu <Chun-hung.Wu@mediatek.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
---
configure.ac | 4 ++++
src/Makefile.am | 1 -
tests/Makefile.am | 1 -
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index afcc1db065e9..54ab695ae1e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -607,6 +607,10 @@ if test x$ENABLE_UBSAN = xyes; then
CXXFLAGS="$CXXFLAGS -fsanitize=undefined"
fi
+if test x$ENABLE_CXX11 = xyes; then
+ CXXFLAGS="$CXXFLAGS -std=c++11"
+fi
+
dnl Check if several decls and constant are defined in dependant
dnl libraries
HAS_EM_AARCH64=no
diff --git a/src/Makefile.am b/src/Makefile.am
index 7c02d538c50d..1d0e2dcecdee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,6 @@ if ENABLE_CXX11
CXX11_SOURCES = abg-viz-common.cc \
abg-viz-dot.cc \
abg-viz-svg.cc
-AM_CXXFLAGS += "-std=c++11"
else
CXX11_SOURCES =
endif
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2104300aed22..14e83608b0e5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,7 +13,6 @@ AM_CXXFLAGS = $(VISIBILITY_FLAGS)
CXX11_TESTS =
if ENABLE_CXX11
CXX11_TESTS += runtestsvg
-AM_CXXFLAGS += "-std=c++11"
endif
FEDABIPKGDIFF_TEST =
--
2.22.0.657.g960e92d24f-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-22 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01 0:00 [PATCH v1] make: ensure a consistent C++ standard use Matthias Maennich via libabigail
2019-01-01 0:00 ` Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).