build in C++17 mode by default

* configure.ac: Activate C++17, and replace --enable-c++17 by
--enable-c++20.
* NEWS: Mention the news.
* .gitlab-ci.yml: Use C++20 for the former C++17 builds.
* HACKING, README, doc/org/compile.org, doc/org/concepts.org,
doc/org/index.org, doc/org/install.org, doc/org/tut.org,
doc/org/upgrade2.org, spot/misc/escape.hh: Adjust mentions
of C++14.
This commit is contained in:
Alexandre Duret-Lutz 2020-07-16 12:12:21 +02:00
parent a770727ee8
commit 4f23097619
12 changed files with 79 additions and 62 deletions

View file

@ -99,7 +99,7 @@ arch-clang:
image: registry.lrde.epita.fr/spot-arch image: registry.lrde.epita.fr/spot-arch
script: script:
- autoreconf -vfi - autoreconf -vfi
- ./configure --prefix ~/install_dir CC='clang -Qunused-arguments' CXX='clang++ -Qunused-arguments' --enable-devel --enable-c++17 --enable-doxygen - ./configure --prefix ~/install_dir CC='clang -Qunused-arguments' CXX='clang++ -Qunused-arguments' --enable-devel --enable-c++20 --enable-doxygen
- make - make
- make distcheck - make distcheck
artifacts: artifacts:
@ -117,9 +117,9 @@ arch-gcc-glibcxxdebug:
image: registry.lrde.epita.fr/spot-arch image: registry.lrde.epita.fr/spot-arch
script: script:
- autoreconf -vfi - autoreconf -vfi
- ./configure --enable-devel --enable-c++17 --enable-glibcxx-debug - ./configure --enable-devel --enable-c++20 --enable-glibcxx-debug
- make - make
- make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-devel --enable-c++17 --enable-glibcxx-debug' - make distcheck DISTCHECK_CONFIGURE_FLAGS='--enable-devel --enable-c++20 --enable-glibcxx-debug'
artifacts: artifacts:
when: on_failure when: on_failure
paths: paths:

26
HACKING
View file

@ -24,7 +24,7 @@ since the generated files they produce are distributed.)
GNU Autoconf >= 2.61 GNU Autoconf >= 2.61
GNU Automake >= 1.11 GNU Automake >= 1.11
GNU Libtool >= 2.4 GNU Libtool >= 2.4
GNU Flex (the version seems to matters, we used 2.5.35) GNU Flex >= 2.5.35
GNU Bison >= 3.0 GNU Bison >= 3.0
GNU Emacs (preferably >= 24 but it may work with older versions) GNU Emacs (preferably >= 24 but it may work with older versions)
org-mode >= 9.1 (the version that comes bundled with your emacs org-mode >= 9.1 (the version that comes bundled with your emacs
@ -32,9 +32,9 @@ since the generated files they produce are distributed.)
a separate and more recent org-mode package, or you can a separate and more recent org-mode package, or you can
simply upgrade from ELPA). simply upgrade from ELPA).
Groff (a.k.a. GNU troff) >= 1.20 Groff (a.k.a. GNU troff) >= 1.20
SWIG >= 3.0.2 (for its better C++11/C++14 support) SWIG >= 3.0.2, preferably >= 4.0.1 (for its better modern C++ support)
Note that if you use Macports you should consider to install the If you use Macports you consider installing the swig-python package
swig-python package in addition to the swig package. in addition to the swig package.
Doxygen >= 1.4.0 Doxygen >= 1.4.0
R used by some examples in the documentation R used by some examples in the documentation
Perl, with its Gettext module (it might be called something like Perl, with its Gettext module (it might be called something like
@ -311,14 +311,22 @@ forget guards, and we do not forget to rename them when a file is
copied into another one. copied into another one.
C++14 C++17
----- -----
Spot uses some C++14 features, and therefore requires a C++14 Spot uses some C++17 features, and therefore requires a C++17
compiler. g++ 5.x or clang++ 3.4 should be enough. compiler. g++ 7.x or clang++ 5 should be enough.
Note that the current stable release, 2.9.x, is still using C++14,
so avoid rewriting the code base into C++17 just because it's nicer,
as it will make harder to backport bug fixes. Feel free to
introduce C++17 feature in new code, or in algorithms that are
largely rewritten.
We currently avoid C++20 features until C++20 compiler are widely
available. (FYI: we switched to C++11 in 2015, to C++14 in 2017,
and to C++17 in 2020.)
We currently avoid C++17 features until C++17 compiler are widely
available.
Encoding Encoding
-------- --------

8
NEWS
View file

@ -1,5 +1,13 @@
New in spot 2.9.1.dev (not yet released) New in spot 2.9.1.dev (not yet released)
Build:
- Spot is now built in C++17 mode, so you need at least GCC 7 or
clang 5 to compile it. The current versions of all major linux
distributions ship with at least GCC 7.4, so this should not be a
problem. There is also an --enable-c++20 option to configure in
case you want to force a build of Spot in C++20 mode.
Library: Library:
- Historically, Spot labels automata by Boolean formulas over - Historically, Spot labels automata by Boolean formulas over

6
README
View file

@ -2,7 +2,7 @@ Overview
======== ========
Spot is a model-checking toolkit comprising: Spot is a model-checking toolkit comprising:
- a C++14 library with data-structures and algorithms for working - a C++17 library with data-structures and algorithms for working
with linear-time temporal logical formulas and ω-automata with with linear-time temporal logical formulas and ω-automata with
any acceptance condition. any acceptance condition.
- a set of command-line tools for easy access to those algorithms, - a set of command-line tools for easy access to those algorithms,
@ -73,8 +73,8 @@ Installation
Requirements Requirements
------------ ------------
Spot requires a C++14-compliant compiler. G++ 5.x or later, as well Spot requires a C++17-compliant compiler. G++ 7.x or later, as well
as Clang++ 3.5 or later should work. as Clang++ 5.0 or later should work.
Spot expects a complete installation of Python (version 3.3 or later). Spot expects a complete installation of Python (version 3.3 or later).
Especially, Python's headers files should be installed. If you don't Especially, Python's headers files should be installed. If you don't

View file

@ -47,11 +47,11 @@ adl_CHECK_BISON
# Decrease verbosity when passing argument V=0 # Decrease verbosity when passing argument V=0
AM_SILENT_RULES([no]) AM_SILENT_RULES([no])
# Option to activate C++17 # Option to activate C++20
AC_ARG_ENABLE([c++17], AC_ARG_ENABLE([c++20],
[AC_HELP_STRING([--enable-c++17], [AC_HELP_STRING([--enable-c++20],
[Compile in C++17 mode.])], [Compile in C++20 mode.])],
[enable_17=$enableval], [enable_17=no]) [enable_20=$enableval], [enable_20=no])
AC_ARG_ENABLE([doxygen], AC_ARG_ENABLE([doxygen],
[AC_HELP_STRING([--enable-doxygen]), [AC_HELP_STRING([--enable-doxygen]),
@ -93,8 +93,8 @@ AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
[CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])]) [CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
CXXFLAGS="$CXXFLAGS -DSPOT_BUILD" CXXFLAGS="$CXXFLAGS -DSPOT_BUILD"
# Turn on C++14 support # Turn on C++17 support
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], m4_define([_AX_CXX_COMPILE_STDCXX_17_testbody],
[AC_LANG_SOURCE([#include <memory> [AC_LANG_SOURCE([#include <memory>
#include <string> #include <string>
#include <chrono> // used to fail in C++11 with some installation of clang #include <chrono> // used to fail in C++11 with some installation of clang
@ -118,28 +118,31 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
check_type&& cr = static_cast<check_type&&>(c); check_type&& cr = static_cast<check_type&&>(c);
auto d = a; auto d = a;
int aa[[2]] = {1,2};
auto [[x,y]] = aa;
])]) ])])
if test x"${enable_17}" = xyes; then if test x"${enable_20}" = xyes; then
for f in -std=c++20 '-std=c++20 -stdlib=libc++' -std=c++2a
do
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
[_AX_CXX_COMPILE_STDCXX_17_testbody])
${stdpass-false} && break
done
if ! "${stdpass-false}"; then
AC_ERROR([unable to turn on C++20 mode with this compiler])
fi
else
for f in -std=c++17 '-std=c++17 -stdlib=libc++' -std=c++1z for f in -std=c++17 '-std=c++17 -stdlib=libc++' -std=c++1z
do do
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [], AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
[_AX_CXX_COMPILE_STDCXX_14_testbody]) [_AX_CXX_COMPILE_STDCXX_17_testbody])
${stdpass-false} && break ${stdpass-false} && break
done done
if ! "${stdpass-false}"; then if ! "${stdpass-false}"; then
AC_ERROR([unable to turn on C++17 mode with this compiler]) AC_ERROR([unable to turn on C++17 mode with this compiler])
fi fi
else
for f in -std=c++14 '-std=c++14 -stdlib=libc++' -std=c++1y
do
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
[_AX_CXX_COMPILE_STDCXX_14_testbody])
${stdpass-false} && break
done
if ! "${stdpass-false}"; then
AC_ERROR([unable to turn on C++14 mode with this compiler])
fi
fi fi
AX_CHECK_BUDDY AX_CHECK_BUDDY

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#+TITLE: Compiling against Spot #+TITLE: Compiling against Spot
#+DESCRIPTION: How to compile C++14 programs using Spot #+DESCRIPTION: How to compile C++17 programs using Spot
#+INCLUDE: setup.org #+INCLUDE: setup.org
#+HTML_LINK_UP: tut.html #+HTML_LINK_UP: tut.html
#+PROPERTY: header-args:C+++ :results verbatim :exports both #+PROPERTY: header-args:C+++ :results verbatim :exports both
@ -31,19 +31,19 @@ greetings and the Spot version:
#+RESULTS: hello-word #+RESULTS: hello-word
: Hello world! : Hello world!
: This is Spot 2.7.2.dev. : This is Spot 2.9.1.dev.
To successfully compile this example program, we need a C++ compiler, To successfully compile this example program, we need a C++ compiler,
obvisously. On this page, we are going to assume that you use =g++= obvisously. On this page, we are going to assume that you use =g++=
(version 4.8 or later), but other compilers like =clang++= share the (version 7 or later), but other compilers like =clang++= share the
same user interface. To successfully build the =hello= program, we same user interface. To successfully build the =hello= program, we
might need to tell the compiler several things: might need to tell the compiler several things:
1. The language that we use is C++14 (or optionally C++17). This 1. The language that we use is C++17 (or optionally C++20). This
usually requires passing an option like =-std=c++14=. Note that usually requires passing an option like =-std=c++17=. Note that
with version 6 of =g++= the default is now to compile C++14, so with version 11 of =g++= the default will be to compile C++17, so
this option is not necessary. this option will not be necessary.
2. The C++ preprocessor should be able to find =spot/misc/version.hh=. 2. The C++ preprocessor should be able to find =spot/misc/version.hh=.
This might require appending another directory to the include This might require appending another directory to the include
search path with =-I location=. search path with =-I location=.

View file

@ -1025,7 +1025,7 @@ layers.
- =libbddx= is a customized version of [[https://sourceforge.net/projects/buddy/][the BuDDy library]], for - =libbddx= is a customized version of [[https://sourceforge.net/projects/buddy/][the BuDDy library]], for
manipulating [[#bdd][BDDs]]. manipulating [[#bdd][BDDs]].
- =libspot= is the main library, containing a C++14 implementation of all the - =libspot= is the main library, containing a C++17 implementation of all the
data structures and algorithms. This depends on =libddx=. data structures and algorithms. This depends on =libddx=.
- =libspotgen= is an auxiliary library that contains functions to - =libspotgen= is an auxiliary library that contains functions to
generate families of automata, useful for benchmarking and testing generate families of automata, useful for benchmarking and testing
@ -1037,7 +1037,7 @@ layers.
SpinS or a patched version of DiVinE, but you have to install SpinS or a patched version of DiVinE, but you have to install
those third-party tools first. See [[https://gitlab.lrde.epita.fr/spot/spot/blob/next/tests/ltsmin/README][=tests/ltsmin/README=]] those third-party tools first. See [[https://gitlab.lrde.epita.fr/spot/spot/blob/next/tests/ltsmin/README][=tests/ltsmin/README=]]
for details. for details.
- In addition to the C++14 API, we also provide Python bindings for - In addition to the C++17 API, we also provide Python bindings for
=libspotgen=, =libspotltsmin=, =libbddx=, and most of =libspot=. =libspotgen=, =libspotltsmin=, =libbddx=, and most of =libspot=.
These are available by importing =spot.gen=, =spot.ltsmin=, =bdd=, These are available by importing =spot.gen=, =spot.ltsmin=, =bdd=,
and =spot=. Those Python bindings also includes some additional and =spot=. Those Python bindings also includes some additional

View file

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#+TITLE: Spot: a platform for LTL and ω-automata manipulation #+TITLE: Spot: a platform for LTL and ω-automata manipulation
#+DESCRIPTION: Spot is a library and tool suite for LTL and ω-automata #+DESCRIPTION: Spot is a library and tool suite for LTL and ω-automata
#+KEYWORDS: Spot,C++14,library,platform,framework,tool-suite,LTL,PSL,omega-automata #+KEYWORDS: Spot,C++17,library,platform,framework,tool-suite,LTL,PSL,omega-automata
#+INCLUDE: setup.org #+INCLUDE: setup.org
#+HTML_HEAD_EXTRA: <style>#org-div-home-and-up { display: none; }</style> #+HTML_HEAD_EXTRA: <style>#org-div-home-and-up { display: none; }</style>
Spot is a C++14 library for LTL, ω-automata manipulation and model Spot is a C++17 library for LTL, ω-automata manipulation and model
checking. It has the following notable features: checking. It has the following notable features:
- Support for [[file:concepts.org::#ltl][LTL]] (several syntaxes supported) and - Support for [[file:concepts.org::#ltl][LTL]] (several syntaxes supported) and

View file

@ -19,8 +19,8 @@ successful development build]].
** Requirements ** Requirements
Spot requires a C++14-compliant compiler. =g++= 5.0 or later, as well Spot requires a C++17-compliant compiler. =g++= 7.0 or later, as well
as =clang++= 3.5 or later should work. as =clang++= 5.0 or later should work.
Spot expects a complete installation of Python (version 3.3 or later). Spot expects a complete installation of Python (version 3.3 or later).
Especially, Python's headers files should be installed (the package to Especially, Python's headers files should be installed (the package to
@ -91,7 +91,7 @@ our [[https://www.lrde.epita.fr/repo/debian.gpg][GPG key]]. Its fingerprint is
9E74 44F2 A84A=, if you want to verify it. 9E74 44F2 A84A=, if you want to verify it.
The package =spot= contains the [[file:tools.org][command-line tools]]. =libspot-dev= The package =spot= contains the [[file:tools.org][command-line tools]]. =libspot-dev=
contains the header files if you plan to use Spot in a C++14 contains the header files if you plan to use Spot in a C++17
program. =spot-doc= contains some html (including these pages) and pdf program. =spot-doc= contains some html (including these pages) and pdf
documentation. Finally =python3-spot= contains some Python bindings documentation. Finally =python3-spot= contains some Python bindings
(this package also installs some ipython notebooks that you can use as (this package also installs some ipython notebooks that you can use as

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#+TITLE: Code Examples #+TITLE: Code Examples
#+DESCRIPTION: Directory of code examples for using Spot in C++14, Python, and shell. #+DESCRIPTION: Directory of code examples for using Spot in C++17, Python, and shell.
#+INCLUDE: setup.org #+INCLUDE: setup.org
#+HTML_LINK_UP: index.html #+HTML_LINK_UP: index.html

View file

@ -17,10 +17,10 @@ experience of updating a couple of projects that are using Spot.
* Overview of the changes * Overview of the changes
Let's begin by just trying to summarize what has changed between Let's begin by just trying to summarize what has changed between
Spot 1.2.6 and Spot 2.0, just to get an idea of what will need to be Spot 1.2.6 and Spot 2.x, just to get an idea of what will need to be
updated. updated.
1. [[#cpp14][Spot now compiles using the C++14 standard]]. Compliant compiler 1. [[#cpp17][Spot now compiles using the C++17 standard]]. Compliant compilers
are sufficiently widespread now that this should not be an issue. are sufficiently widespread now that this should not be an issue.
2. The layout of the source-tree and the layout of the installed 2. The layout of the source-tree and the layout of the installed
@ -83,22 +83,20 @@ experience of updating a couple of projects that are using Spot.
numbered. Many algorithms have been rewritten on top of this numbered. Many algorithms have been rewritten on top of this
=twa_graph= class, and this simplified them a lot. =twa_graph= class, and this simplified them a lot.
* Upgrading to C++14 * Upgrading to C++17
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: cpp14 :CUSTOM_ID: cpp17
:END: :END:
Because Spot now relies on C++14 features, programs that use Spot Because Spot now relies on C++17 features, programs that use Spot
should at least be compiled using this version (or a later one) of should at least be compiled using this version (or a later one) of
the language. the language.
Before the =g++= 6.0, the default C++ standard used was C++98, and This is usually done by passing the option =-std=c++17= to =g++= or
enabling C++14 is usually done by passing the option =-std=c++14=. =clang++=.
In =g++= 6.0 the default C++ standard used is C++14, so passing
=-std=c++14= is not necessary.
Upgrading from C++98, C++03 or C++11 to C++14 should be relatively Upgrading from C++98, C++03, C++11, or C++14 to C++17 should be
smooth as the language is /mostly/ backward compatible. relatively smooth as the language is /mostly/ backward compatible.
* Upgrading =#include= directives * Upgrading =#include= directives
:PROPERTIES: :PROPERTIES:

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011-2013, 2015, 2018 Laboratoire de Recherche et // Copyright (C) 2011-2013, 2015, 2018, 2020 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE). // Developpement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -36,7 +36,7 @@ namespace spot
/// In CSV files, as defined by RFC4180, double-quoted string that /// In CSV files, as defined by RFC4180, double-quoted string that
/// contain double-quotes should simply duplicate those quotes. /// contain double-quotes should simply duplicate those quotes.
/// ///
/// Note that in C++14, /// Note that since C++14,
/// ``` /// ```
/// os << std::quoted(str, '"', '"'); /// os << std::quoted(str, '"', '"');
/// ``` /// ```