Enable -fvisibility=hidden for src/misc/.

* configure.ac: Check for -fvisibility support.
* m4/ax_check_compile_flag.m4: New file.
* src/misc/common.hh: New file.
* src/misc/Makefile.am: Add common.hh, and adjust to use -fvisibility.
* src/misc/bareword.hh, src/misc/escape.hh, src/misc/formater.hh,
src/misc/intvcmp2.hh, src/misc/intvcomp.hh, src/misc/memusage.hh,
src/misc/minato.hh, src/misc/optionmap.hh, src/misc/random.hh,
src/misc/timer.hh, src/misc/version.hh, src/misc/bddop.hh: Include
common.hh and add SPOT_API tags.
* src/misc/acccompl.hh, src/misc/accconv.hh: Prepare for upcoming
move.
* src/sanity/style.test: Ignore SPOT_API tags.
* wrap/python/Makefile.am: Ignore SPOT_API.
* wrap/python/spot.i: Do not emit binding for bddalloc.hh.
* wrap/python/tests/minato.py: Do not use bdd_allocator.
This commit is contained in:
Alexandre Duret-Lutz 2013-06-24 21:39:22 +02:00
parent b5710663f4
commit 2ef8917ba5
22 changed files with 258 additions and 78 deletions

View file

@ -1,8 +1,9 @@
## Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement
## de l'Epita (LRDE).
## -*- coding: utf-8 -*-
## Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et
## Développement de l'Epita (LRDE).
## Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
## Université Pierre et Marie Curie.
## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
## Université Pierre et Marie Curie.
##
## This file is part of Spot, a model checking library.
##
@ -20,7 +21,7 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
AM_CPPFLAGS = -I$(srcdir)/.. -I.. $(BUDDY_CPPFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(VISIBILITY_CXXFLAGS)
miscdir = $(pkgincludedir)/misc
@ -35,6 +36,7 @@ misc_HEADERS = \
bddlt.hh \
bddop.hh \
casts.hh \
common.hh \
escape.hh \
fixpool.hh \
formater.hh \
@ -45,8 +47,8 @@ misc_HEADERS = \
intvcmp2.hh \
ltstr.hh \
minato.hh \
memusage.hh \
modgray.hh \
memusage.hh \
mspool.hh \
optionmap.hh \
random.hh \
@ -62,13 +64,13 @@ libmisc_la_SOURCES = \
bddalloc.cc \
bddop.cc \
escape.cc \
freelist.cc \
formater.cc \
freelist.cc \
intvcomp.cc \
intvcmp2.cc \
modgray.cc \
memusage.cc \
minato.cc \
modgray.cc \
optionmap.cc \
random.cc \
timer.cc \

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Developpement de
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -18,8 +18,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SPOT_MISC_ACCCOMPL_HH
# define SPOT_MISC_ACCCOMPL_HH
#ifndef SPOT_PRIV_ACCCOMPL_HH
# define SPOT_PRIV_ACCCOMPL_HH
#include <map>
#include <bdd.h>
@ -53,4 +53,4 @@ namespace spot
};
} // End namespace Spot
#endif // !SPOT_MISC_ACCCOMPL_HH
#endif // SPOT_PRIV_ACCCOMPL_HH

View file

@ -1,4 +1,4 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -16,8 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SPOT_MISC_ACCCONV_HH
# define SPOT_MISC_ACCCONV_HH
#ifndef SPOT_PRIV_ACCCONV_HH
# define SPOT_PRIV_ACCCONV_HH
#include <bdd.h>
#include "misc/hash.hh"
@ -48,4 +48,4 @@ namespace spot
}
#endif // SPOT_MISC_ACCCONV_HH
#endif // SPOT_PRIV_ACCCONV_HH

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2004, 2005 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
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -20,7 +23,8 @@
#ifndef SPOT_MISC_BAREWORD_HH
# define SPOT_MISC_BAREWORD_HH
#include <string>
# include "common.hh"
# include <string>
namespace spot
{
@ -28,13 +32,14 @@ namespace spot
/// @{
/// \brief Whether a word is bare.
///
/// Bare words should start with a letter or an underscore, and
/// consist solely of alphanumeric characters and underscores.
bool is_bare_word(const char* str);
/// Bare words should start with a letter, an underscore, or a dot,
/// and consist solely of alphanumeric characters, underscores, and
/// dots.
SPOT_API bool is_bare_word(const char* str);
/// \brief Double-quote words that are not bare.
/// \see is_bare_word
std::string quote_unless_bare_word(const std::string& str);
SPOT_API std::string quote_unless_bare_word(const std::string& str);
/// @}
}

View file

@ -1,4 +1,5 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -19,17 +20,20 @@
#ifndef SPOT_MISC_BDDOP_HH
# define SPOT_MISC_BDDOP_HH
#include "common.hh"
#include "bdd.h"
namespace spot
{
/// \brief Compute all acceptance conditions from all neg acceptance
/// conditions.
bdd compute_all_acceptance_conditions(bdd neg_acceptance_conditions);
SPOT_API bdd
compute_all_acceptance_conditions(bdd neg_acceptance_conditions);
/// \brief Compute neg acceptance conditions from all acceptance
/// conditions.
bdd compute_neg_acceptance_conditions(bdd all_acceptance_conditions);
SPOT_API bdd
compute_neg_acceptance_conditions(bdd all_acceptance_conditions);
}
#endif // SPOT_MISC_BDDOP_HH

59
src/misc/common.hh Normal file
View file

@ -0,0 +1,59 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SPOT_MISC_COMMON_HH
# define SPOT_MISC_COMMON_HH
#if defined _WIN32 || defined __CYGWIN__
#define SPOT_HELPER_DLL_IMPORT __declspec(dllimport)
#define SPOT_HELPER_DLL_EXPORT __declspec(dllexport)
#define SPOT_HELPER_DLL_LOCAL
#else
#if __GNUC__ >= 4
#define SPOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
#define SPOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
#define SPOT_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
#else
#define SPOT_HELPER_DLL_IMPORT
#define SPOT_HELPER_DLL_EXPORT
#define SPOT_HELPER_DLL_LOCAL
#endif
#endif
#ifdef SPOT_BUILD
#define SPOT_DLL
#endif
// SPOT_API is used for the public API symbols. It either DLL imports
// or DLL exports (or does nothing for static build) SPOT_LOCAL is
// used for non-api symbols that may occur in header files.
#ifdef SPOT_DLL
#ifdef SPOT_BUILD
#define SPOT_API SPOT_HELPER_DLL_EXPORT
#else
#define SPOT_API SPOT_HELPER_DLL_IMPORT
#endif
#define SPOT_LOCAL SPOT_HELPER_DLL_LOCAL
#else
#define SPOT_API
#define SPOT_LOCAL
#endif
#define SPOT_API_VAR extern SPOT_API
#endif // SPOT_MISC_COMMON_HH

View file

@ -1,7 +1,8 @@
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et
// Developpement 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
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -22,6 +23,7 @@
#ifndef SPOT_MISC_ESCAPE_HH
# define SPOT_MISC_ESCAPE_HH
# include "common.hh"
# include <iosfwd>
# include <string>
@ -32,14 +34,14 @@ namespace spot
/// \brief Escape characters <code>"</code>, <code>\\</code>, and
/// <code>\\n</code> in \a str.
std::ostream& escape_str(std::ostream& os, const std::string& str);
SPOT_API std::ostream& escape_str(std::ostream& os, const std::string& str);
/// \brief Escape characters <code>"</code>, <code>\\</code>, and
/// <code>\\n</code> in \a str.
std::string escape_str(const std::string& str);
SPOT_API std::string escape_str(const std::string& str);
/// \brief Remove spaces at the front and back of \a str.
void trim(std::string& str);
SPOT_API void trim(std::string& str);
/// @}
}

View file

@ -20,6 +20,7 @@
#ifndef SPOT_MISC_FORMATER_HH
#define SPOT_MISC_FORMATER_HH
#include "common.hh"
#include <iostream>
#include <string>
#include <vector>
@ -101,7 +102,7 @@ namespace spot
};
class formater
class SPOT_API formater
{
printable_id id;
printable_percent percent;

View file

@ -1,4 +1,5 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -19,8 +20,9 @@
#ifndef SPOT_MISC_INTVCMP2_HH
# define SPOT_MISC_INTVCMP2_HH
#include <vector>
#include <stddef.h>
# include "common.hh"
# include <vector>
# include <stddef.h>
namespace spot
{
@ -33,7 +35,7 @@ namespace spot
/// assert will be triggered if \a dest_size is too small. On
/// return, \a dest_size will be set to the actually number of int
/// filled in \a dest
void
SPOT_API void
int_array_array_compress2(const int* array, size_t n,
int* dest, size_t& dest_size);
@ -41,7 +43,7 @@ namespace spot
/// array of size \a size.
///
/// \a size must be the exact expected size of uncompressed array.
void
SPOT_API void
int_array_array_decompress2(const int* array, size_t array_size,
int* res, size_t size);

View file

@ -1,5 +1,6 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -19,8 +20,9 @@
#ifndef SPOT_MISC_INTVCOMP_HH
# define SPOT_MISC_INTVCOMP_HH
#include <vector>
#include <stddef.h>
# include "common.hh"
# include <vector>
# include <stddef.h>
namespace spot
{
@ -28,7 +30,7 @@ namespace spot
/// @{
/// Compress an int vector into a vector of unsigned int.
void
SPOT_API void
int_vector_vector_compress(const std::vector<int>& input,
std::vector<unsigned int>& output);
@ -36,19 +38,19 @@ namespace spot
/// size \a size.
///
/// \a size must be the exact expected size of uncompressed array.
void
SPOT_API void
int_vector_vector_decompress(const std::vector<unsigned int>& array,
std::vector<int>& output, size_t size);
/// Compress an int array if size \a n into a vector of unsigned int.
const std::vector<unsigned int>*
SPOT_API const std::vector<unsigned int>*
int_array_vector_compress(const int* array, size_t n);
/// \brief Uncompress a vector of unsigned int into an int array of
/// size \a size.
///
/// \a size must be the exact expected size of uncompressed array.
void
SPOT_API void
int_vector_array_decompress(const std::vector<unsigned int>* array,
int* res, size_t size);
@ -58,7 +60,7 @@ namespace spot
/// assert will be triggered if \a dest_size is too small. On
/// return, \a dest_size will be set to the actually number of int
/// filled in \a dest
void
SPOT_API void
int_array_array_compress(const int* array, size_t n,
int* dest, size_t& dest_size);
@ -66,7 +68,7 @@ namespace spot
/// array of size \a size.
///
/// \a size must be the exact expected size of uncompressed array.
void
SPOT_API void
int_array_array_decompress(const int* array, size_t array_size,
int* res, size_t size);

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2006 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
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -20,6 +23,7 @@
#ifndef SPOT_MISC_MEMUSAGE_HH
# define SPOT_MISC_MEMUSAGE_HH
#include "common.hh"
namespace spot
{
@ -27,7 +31,7 @@ namespace spot
///
/// \return The total number of pages in use by the program if known.
/// -1 otherwise.
int memusage();
SPOT_API int memusage();
}
#endif // SPOT_MISC_MEMUSAGE_HH

View file

@ -1,7 +1,8 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 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
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -22,6 +23,7 @@
#ifndef SPOT_MISC_MINATO_HH
# define SPOT_MISC_MINATO_HH
# include "common.hh"
# include <bdd.h>
# include <stack>
@ -47,7 +49,7 @@ namespace spot
month = {April}
}
\endverbatim */
class minato_isop
class SPOT_API minato_isop
{
public:
/// \brief Conctructor.

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE)
// Copyright (C) 2005 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
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -20,6 +23,7 @@
#ifndef SPOT_MISC_OPTIONMAP_HH
# define SPOT_MISC_OPTIONMAP_HH
#include "common.hh"
#include <string>
#include <map>
#include <iosfwd>
@ -30,7 +34,7 @@ namespace spot
/// \brief Manage a map of options.
///
/// Each option is defined by a string and is associated to an integer value.
class option_map
class SPOT_API option_map
{
public:
/// \brief Add the parsed options to the map.
@ -76,7 +80,8 @@ namespace spot
int& operator[](const char* option);
/// \brief Print the option_map \a m.
friend std::ostream& operator<<(std::ostream& os, const option_map& m);
friend SPOT_API std::ostream&
operator<<(std::ostream& os, const option_map& m);
private:
std::map<std::string, int> options_;

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 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
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -20,6 +23,7 @@
#ifndef SPOT_MISC_RANDOM_HH
# define SPOT_MISC_RANDOM_HH
# include "common.hh"
# include <cmath>
namespace spot
@ -31,25 +35,25 @@ namespace spot
/// \brief Reset the seed of the pseudo-random number generator.
///
/// \see drand, mrand, rrand
void srand(unsigned int seed);
SPOT_API void srand(unsigned int seed);
/// \brief Compute a pseudo-random integer value between \a min and
/// \a max included.
///
/// \see drand, mrand, srand
int rrand(int min, int max);
SPOT_API int rrand(int min, int max);
/// \brief Compute a pseudo-random integer value between 0 and
/// \a max-1 included.
///
/// \see drand, rrand, srand
int mrand(int max);
SPOT_API int mrand(int max);
/// \brief Compute a pseudo-random double value
/// between 0.0 and 1.0 (1.0 excluded).
///
/// \see mrand, rrand, srand
double drand();
SPOT_API double drand();
/// \brief Compute a pseudo-random double value
/// following a standard normal distribution. (Odeh & Evans)
@ -57,14 +61,14 @@ namespace spot
/// This uses a polynomial approximation of the inverse cumulated
/// density function from Odeh & Evans, Journal of Applied
/// Statistics, 1974, vol 23, pp 96-97.
double nrand();
SPOT_API double nrand();
/// \brief Compute a pseudo-random double value
/// following a standard normal distribution. (Box-Muller)
///
/// This uses the polar form of the Box-Muller transform
/// to generate random values.
double bmrand();
SPOT_API double bmrand();
/// \brief Compute pseudo-random integer value between 0
/// and \a n included, following a binomial distribution
@ -112,7 +116,7 @@ namespace spot
/// following a Poisson distribution with parameter \a p.
///
/// \pre <code>p > 0</code>
int prand(double p);
SPOT_API int prand(double p);
/// @}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et
// Copyright (C) 2009, 2011, 2012, 2013 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
@ -23,6 +23,7 @@
#ifndef SPOT_MISC_TIMER_HH
# define SPOT_MISC_TIMER_HH
# include "common.hh"
# include "misc/_config.h"
# include <cassert>
# include <iosfwd>
@ -200,7 +201,7 @@ namespace spot
}
/// Format information about all timers in a table.
std::ostream&
SPOT_API std::ostream&
print(std::ostream& os) const;
/// \brief Remove information about all timers.

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 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
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -20,11 +23,13 @@
#ifndef SPOT_MISC_VERSION_HH
# define SPOT_MISC_VERSION_HH
# include "common.hh"
namespace spot
{
/// \ingroup misc_tools
/// \brief Return Spot's version.
const char* version();
SPOT_API const char* version();
}
#endif // SPOT_MISC_VERSION_HH

View file

@ -86,10 +86,13 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
# //
# //
# to keep the line numbers correct in the diagnostics.
#
# Also get read of the SPOT_API tags.
perl -pe 'sub f {my $a = shift; $a =~ s:[^\n]*://:g; return "$a"}
s,/\*(.*?)\*/,f($1),sge;
s,//.*?\n,//\n,g;
s,"[^"\n]*","",g' -0777 <$file >$tmp
s,"[^"\n]*","",g;
s,SPOT_API ,,g' -0777 <$file >$tmp
grep '[ ]$' $tmp &&
diag 'Trailing whitespace.'