From 9f7bf5ab2d74eac778cc8d076de12c74ab55bc88 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 24 Jul 2016 00:05:25 +0200 Subject: [PATCH] configure: support --enable-glibgxx-debug Part of #184. * m4/devel.m4 (adl_ENABLE_GLIBCXX_DEBUG): New macro. * configure.ac: Use it. * README: Mention it. * spot/twa/acc.cc: Fix a small issue found with this option. --- README | 8 ++++++++ configure.ac | 1 + m4/devel.m4 | 10 ++++++++++ spot/twa/acc.cc | 3 ++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README b/README index b8080794c..80539aa1b 100644 --- a/README +++ b/README @@ -87,6 +87,14 @@ flags specific to Spot: --disable-assert --enable-optimizations + --enable-glibgxx-debug + Enable the debugging version libstdc++ + https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_semantics.html + Note that the debugging version og libstdc++ is incompatible with + the regular version. So if Spot is compiled with this option, all + client code should be compiled with -D_GLIBCXX_DEBUG as well. This + options should normally only be useful to run Spot's test-suite. + Here are the meaning of the fine-tuning options, in case --enable/disable-devel is not enough. diff --git a/configure.ac b/configure.ac index 27dc42b40..529e2122e 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,7 @@ fi adl_ENABLE_DEBUG ad_GCC_OPTIM adl_NDEBUG +adl_ENABLE_GLIBCXX_DEBUG spot_INTEL if test x$enable_warnings = xyes; then diff --git a/m4/devel.m4 b/m4/devel.m4 index 280c35505..2cbfff661 100644 --- a/m4/devel.m4 +++ b/m4/devel.m4 @@ -27,3 +27,13 @@ AC_DEFUN([adl_ENABLE_DEVEL], enable_optimizations=${enable_optimizations--O} fi ]) + + +AC_DEFUN([adl_ENABLE_GLIBCXX_DEBUG], +[AC_ARG_ENABLE([glibcxx-debug], + [AC_HELP_STRING([--enable-glibcxx-debug], + [turn on use the libstdc++ debug mode (see README)])]) +if test x$enable_glibcxx_debug = xyes; then + CPPFLAGS="$CPPFLAGS -D_GLIBCXX_DEBUG" +fi +]) diff --git a/spot/twa/acc.cc b/spot/twa/acc.cc index 01f7f077a..44a688d6f 100644 --- a/spot/twa/acc.cc +++ b/spot/twa/acc.cc @@ -574,7 +574,8 @@ namespace spot { // Pick a random code and put it at the end int p1 = mrand(s--); - std::swap(codes[p1], codes[s]); + if (p1 != s) // https://gcc.gnu.org/bugzilla//show_bug.cgi?id=59603 + std::swap(codes[p1], codes[s]); // and another one int p2 = mrand(s);