Skip to content

Commit

Permalink
switch to C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Dreik committed Jan 12, 2025
1 parent 74a1505 commit 157f26a
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/debian-bookworm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
- name: build with hardened build flags
run: |
make clean
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/debian-bullseye.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
- name: build with hardened build flags
run: |
make clean
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/debian-trixie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
- name: build with hardened build flags
run: |
make clean
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fedora-40.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make -j $(nproc)
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
- name: store the logs as an artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fedora-41.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make -j $(nproc)
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
- name: store the logs as an artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS="-std=c++11 -I$(brew --prefix nettle)/include -L$(brew --prefix nettle)/lib"
run: ./configure --enable-warnings CXXFLAGS="-std=c++17 -I$(brew --prefix nettle)/include -L$(brew --prefix nettle)/lib"
- name: make
run: make
# tests fail because readlink does not understand -f on mac
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: bootstrap
run: ./bootstrap.sh
- name: configure
run: ./configure --enable-warnings CXXFLAGS=-std=c++11
run: ./configure --enable-warnings CXXFLAGS=-std=c++17
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck CXXFLAGS=-std=c++11
run: make distcheck CXXFLAGS=-std=c++17
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ AC_CHECK_FUNC(stat,,AC_MSG_ERROR(oops! no stat ?!?))
dnl check for 64 bit support
AC_SYS_LARGEFILE

dnl make sure we have c++11 or better,
AC_MSG_CHECKING([for C++11 support or better])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int f() { auto a=1;return a;}])],
dnl make sure we have c++17 or better,
AC_MSG_CHECKING([for C++17 support or better])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int f() { if constexpr(true) {auto a=1;return a;} else {return 2;}}])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([no c++11 support, please set CXXFLAGS properly])])
[AC_MSG_ERROR([no c++17 support, please set CXXFLAGS properly])])

AC_SUBST(VERSION)

Expand Down
2 changes: 1 addition & 1 deletion cppcheck/run_cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ me=$(basename $0)

mkdir -p $outdir

args="--enable=all --inconclusive --std=c++11 -I . --quiet --suppress=missingIncludeSystem"
args="--enable=all --inconclusive --std=c++17 -I . --quiet --suppress=missingIncludeSystem"

# cppcheck can not produce an xml report and a reulgar text file at the same time, so run twice
cppcheck $args *.cc *.hh --template='{severity}:{file}:{line}:{message}' 2>$outdir/cppcheck.out
Expand Down
6 changes: 3 additions & 3 deletions do_quality_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ compile_and_test() {
#works. clang 4 with c++2a does not.
/bin/echo -e "#include <iostream>">x.cpp
#does the compiler understand c++11? That is mandatory.
if ! $1 -c x.cpp -std=c++11 >/dev/null 2>&1 ; then
if ! $1 -c x.cpp -std=c++17 >/dev/null 2>&1 ; then
echo $me: this compiler $1 does not understand c++11
return 0
fi
Expand Down Expand Up @@ -197,7 +197,7 @@ run_with_libcpp() {
int main() { std::cout<<\"libc++ works!\"<<std::endl;}" >x.cpp
get_latest_clang
if [ ! -z $latestclang ] ; then
if ! $latestclang -std=c++11 -stdlib=libc++ -lc++abi x.cpp >/dev/null 2>&1 || [ ! -x ./a.out ] || ! ./a.out ; then
if ! $latestclang -std=c++17 -stdlib=libc++ -lc++abi x.cpp >/dev/null 2>&1 || [ ! -x ./a.out ] || ! ./a.out ; then
echo $me: "debug: $latestclang could not compile with libc++ - perhaps uninstalled."
continue
fi
Expand Down Expand Up @@ -247,7 +247,7 @@ verify_self_contained_headers() {
fi
for header in *.hh ; do
cp $header tmp.cc
if ! g++ -std=c++11 -I. -c tmp.cc -o /dev/null >header.log 2>&1 ; then
if ! g++ -std=c++17 -I. -c tmp.cc -o /dev/null >header.log 2>&1 ; then
echo "$me: found a header which is not self contained: $header."
echo "$me: see header.log for details"
exit 1
Expand Down

0 comments on commit 157f26a

Please sign in to comment.