From 6b88d6f35b2ee533df991b9a2ce91e1cc42ecba5 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 2 Mar 2022 17:37:25 +0100 Subject: [PATCH] configure: remove some header checks do them using C++17's __has_include instead * configure.ac: Do not check for sys/times.h, valgrind/memcheck.h, and spawn.h. * bin/common_trans.cc, spot/misc/fixpool.hh, spot/misc/mspool.hh, spot/misc/timer.hh: Adjust to use __has_include instead. --- bin/common_trans.cc | 5 +++-- configure.ac | 1 - spot/misc/fixpool.hh | 12 +++++++----- spot/misc/mspool.hh | 14 ++++++++------ spot/misc/timer.hh | 4 ++-- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/bin/common_trans.cc b/bin/common_trans.cc index 78cb632ed..a9b823ff4 100644 --- a/bin/common_trans.cc +++ b/bin/common_trans.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2015-2021 Laboratoire de Recherche et Développement +// Copyright (C) 2015-2022 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -27,7 +27,8 @@ #include #include #include -#ifdef HAVE_SPAWN_H +#if __has_include() +#define HAVE_SPAWN_H 1 #include #endif #include diff --git a/configure.ac b/configure.ac index 31002ccda..81d5a24e3 100644 --- a/configure.ac +++ b/configure.ac @@ -147,7 +147,6 @@ CHECK_ATOMIC AX_CHECK_BUDDY -AC_CHECK_HEADERS([sys/times.h valgrind/memcheck.h spawn.h]) AC_CHECK_FUNCS([times kill alarm sigaction sched_getcpu]) oLIBS=$LIBS diff --git a/spot/misc/fixpool.hh b/spot/misc/fixpool.hh index e552999c9..0b7c1e92f 100644 --- a/spot/misc/fixpool.hh +++ b/spot/misc/fixpool.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2011, 2015-2018, 2020 Laboratoire de Recherche et +// Copyright (C) 2011, 2015-2018, 2020, 2022 Laboratoire de Recherche et // Développement de l'Epita (LRDE) // // This file is part of Spot, a model checking library. @@ -22,7 +22,9 @@ #include #include -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#if SPOT_DEBUG && __has_include() +#undef USES_MEMCHECK_H +#define USES_MEMCHECK_H 1 #include #endif @@ -90,7 +92,7 @@ namespace spot // If we have free blocks available, return the first one. if (f) { -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H if (Kind == pool_type::Safe) { VALGRIND_MALLOCLIKE_BLOCK(f, size_, 0, false); @@ -112,7 +114,7 @@ namespace spot void* res = free_start_; free_start_ += size_; -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H if (Kind == pool_type::Safe) { VALGRIND_MALLOCLIKE_BLOCK(res, size_, 0, false); @@ -134,7 +136,7 @@ namespace spot block_* b = reinterpret_cast(ptr); b->next = freelist_; freelist_ = b; -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H if (Kind == pool_type::Safe) { VALGRIND_FREELIKE_BLOCK(ptr, 0); diff --git a/spot/misc/mspool.hh b/spot/misc/mspool.hh index e83ff3cc2..c2eb0428b 100644 --- a/spot/misc/mspool.hh +++ b/spot/misc/mspool.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2011, 2013, 2015, 2016, 2018 Laboratoire de Recherche et -// Developpement de l'Epita (LRDE) +// Copyright (C) 2011, 2013, 2015-2016, 2018, 2022 Laboratoire de +// Recherche et Developpement de l'Epita (LRDE) // // This file is part of Spot, a model checking library. // @@ -22,7 +22,9 @@ #include #include -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#if SPOT_DEBUG && __has_include() +#undef USES_MEMCHECK_H +#define USES_MEMCHECK_H 1 #include #endif @@ -70,7 +72,7 @@ namespace spot if (f) { block_* first = f; -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H VALGRIND_MALLOCLIKE_BLOCK(f, size, 0, false); // field f->next is initialized: prevents valgrind from complaining // about jumps depending on uninitialized memory @@ -99,7 +101,7 @@ namespace spot void* res = free_start_; free_start_ += size; -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H VALGRIND_MALLOCLIKE_BLOCK(res, size, 0, false); #endif return res; @@ -123,7 +125,7 @@ namespace spot block_*& f = freelist_[size]; b->next = f; f = b; -#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) +#ifdef USES_MEMCHECK_H VALGRIND_FREELIKE_BLOCK(ptr, 0); #endif } diff --git a/spot/misc/timer.hh b/spot/misc/timer.hh index a30d00e78..9a7d754c3 100644 --- a/spot/misc/timer.hh +++ b/spot/misc/timer.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de +// Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015, 2016, 2022 Laboratoire de // Recherche et Développement de l'Epita (LRDE). // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -29,7 +29,7 @@ #include #include #include -#if SPOT_HAVE_SYS_TIMES_H +#if __has_include() # include #endif #include