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.
This commit is contained in:
Alexandre Duret-Lutz 2022-03-02 17:37:25 +01:00
parent cdc89dad16
commit 6b88d6f35b
5 changed files with 20 additions and 16 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- 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). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -27,7 +27,8 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h> #include <fcntl.h>
#include <iomanip> #include <iomanip>
#ifdef HAVE_SPAWN_H #if __has_include(<spawn.h>)
#define HAVE_SPAWN_H 1
#include <spawn.h> #include <spawn.h>
#endif #endif
#include <regex> #include <regex>

View file

@ -147,7 +147,6 @@ CHECK_ATOMIC
AX_CHECK_BUDDY AX_CHECK_BUDDY
AC_CHECK_HEADERS([sys/times.h valgrind/memcheck.h spawn.h])
AC_CHECK_FUNCS([times kill alarm sigaction sched_getcpu]) AC_CHECK_FUNCS([times kill alarm sigaction sched_getcpu])
oLIBS=$LIBS oLIBS=$LIBS

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- 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) // Développement de l'Epita (LRDE)
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -22,7 +22,9 @@
#include <spot/misc/common.hh> #include <spot/misc/common.hh>
#include <spot/misc/clz.hh> #include <spot/misc/clz.hh>
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #if SPOT_DEBUG && __has_include(<valgrind/memcheck.h>)
#undef USES_MEMCHECK_H
#define USES_MEMCHECK_H 1
#include <valgrind/memcheck.h> #include <valgrind/memcheck.h>
#endif #endif
@ -90,7 +92,7 @@ namespace spot
// If we have free blocks available, return the first one. // If we have free blocks available, return the first one.
if (f) if (f)
{ {
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
if (Kind == pool_type::Safe) if (Kind == pool_type::Safe)
{ {
VALGRIND_MALLOCLIKE_BLOCK(f, size_, 0, false); VALGRIND_MALLOCLIKE_BLOCK(f, size_, 0, false);
@ -112,7 +114,7 @@ namespace spot
void* res = free_start_; void* res = free_start_;
free_start_ += size_; free_start_ += size_;
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
if (Kind == pool_type::Safe) if (Kind == pool_type::Safe)
{ {
VALGRIND_MALLOCLIKE_BLOCK(res, size_, 0, false); VALGRIND_MALLOCLIKE_BLOCK(res, size_, 0, false);
@ -134,7 +136,7 @@ namespace spot
block_* b = reinterpret_cast<block_*>(ptr); block_* b = reinterpret_cast<block_*>(ptr);
b->next = freelist_; b->next = freelist_;
freelist_ = b; freelist_ = b;
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
if (Kind == pool_type::Safe) if (Kind == pool_type::Safe)
{ {
VALGRIND_FREELIKE_BLOCK(ptr, 0); VALGRIND_FREELIKE_BLOCK(ptr, 0);

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2015, 2016, 2018 Laboratoire de Recherche et // Copyright (C) 2011, 2013, 2015-2016, 2018, 2022 Laboratoire de
// Developpement de l'Epita (LRDE) // Recherche et Developpement de l'Epita (LRDE)
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -22,7 +22,9 @@
#include <spot/misc/common.hh> #include <spot/misc/common.hh>
#include <unordered_map> #include <unordered_map>
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #if SPOT_DEBUG && __has_include(<valgrind/memcheck.h>)
#undef USES_MEMCHECK_H
#define USES_MEMCHECK_H 1
#include <valgrind/memcheck.h> #include <valgrind/memcheck.h>
#endif #endif
@ -70,7 +72,7 @@ namespace spot
if (f) if (f)
{ {
block_* first = f; block_* first = f;
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
VALGRIND_MALLOCLIKE_BLOCK(f, size, 0, false); VALGRIND_MALLOCLIKE_BLOCK(f, size, 0, false);
// field f->next is initialized: prevents valgrind from complaining // field f->next is initialized: prevents valgrind from complaining
// about jumps depending on uninitialized memory // about jumps depending on uninitialized memory
@ -99,7 +101,7 @@ namespace spot
void* res = free_start_; void* res = free_start_;
free_start_ += size; free_start_ += size;
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
VALGRIND_MALLOCLIKE_BLOCK(res, size, 0, false); VALGRIND_MALLOCLIKE_BLOCK(res, size, 0, false);
#endif #endif
return res; return res;
@ -123,7 +125,7 @@ namespace spot
block_*& f = freelist_[size]; block_*& f = freelist_[size];
b->next = f; b->next = f;
f = b; f = b;
#if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) #ifdef USES_MEMCHECK_H
VALGRIND_FREELIKE_BLOCK(ptr, 0); VALGRIND_FREELIKE_BLOCK(ptr, 0);
#endif #endif
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- 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). // Recherche et Développement 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
@ -29,7 +29,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <chrono> #include <chrono>
#if SPOT_HAVE_SYS_TIMES_H #if __has_include(<sys/times.h>)
# include <sys/times.h> # include <sys/times.h>
#endif #endif
#include <ctime> #include <ctime>