Commit 2ef8917b authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent b5710663
......@@ -60,6 +60,14 @@ gl_INIT
AC_LANG(C++)
# Use -Werror since using -fvisibility under MinGW is only a warning.
# (The option is ignored anyway since this does not make sense under windows).
AC_SUBST([VISIBILITY_CXXFLAGS])
AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
[VISIBILITY_CXXFLAGS="$VISIBILITY_CXXFLAGS -fvisibility=hidden -DSPOT_BUILD"
AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden],
[VISIBILITY_CXXFLAGS="$VISIBILITY_CXXFLAGS -fvisibility-inlines-hidden"])])
AC_HEADER_UNORDERED_MAP
AC_HEADER_TR1_UNORDERED_MAP
AC_HEADER_EXT_HASH_MAP
......
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program 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.
#
# This program 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/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
## Copyright (C) 2011, 2012 Laboratoire de Recherche et Dveloppement
## 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), dpartement Systmes Rpartis Coopratifs (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 \
......
// -*- 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
// 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
// -*- 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),
// dpartement Systmes Rpartis Coopratifs (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);
/// @}
}
......
// 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
// -*- 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
// 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);
/// @}
}
......
......@@ -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;
......
// 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);
......
// 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);
......
// -*- 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
// 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.
......
// -*- 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_;
......
// -*- 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);
/// @}
}
......
// -*- 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