Common.hpp

Go to the documentation of this file.
00001 #ifndef wali_COMMON_GUARD
00002 #define wali_COMMON_GUARD 1
00003 
00004 /**
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include <climits>
00009 #include <string>
00010 #include <iostream>
00011 #include "wali/Key.hpp"
00012 
00013 namespace wali
00014 {
00015   typedef Key wali_key_t;
00016   static const Key WALI_EPSILON = 0;
00017   static const Key WALI_WILD = 1;
00018   static const Key WALI_BAD_KEY = UINT_MAX;
00019 
00020   // std::cerr is the default err stream
00021   extern std::ostream* waliErr;
00022 
00023   //! Sets error stream waliErr to param newErr
00024   //! @param newErr std::ostream*
00025   //! @return old err ostream
00026   extern std::ostream* set_wali_err( std::ostream* newErr );
00027 
00028   //! @return old err ostream
00029   extern std::ostream* setWaliErr( std::ostream* newErr );
00030 
00031   /*!
00032    * When running pre or post* query in FWPDS,
00033    * setting this to true will also run the same
00034    * query using regular EWPDS and verify the results
00035    * are the same.
00036    *
00037    * @param enable turn FWPDS verification on/off
00038    */
00039   extern void set_verify_fwpds( bool enable );
00040 
00041   //! @return whether FWPDS reachability is to be verified
00042   extern bool get_verify_fwpds();
00043 
00044   /*!
00045    * @brief Turn lazy weights on or off for FWPDS
00046    * @return void
00047    */
00048   extern void set_lazy_fwpds( bool enable );
00049 
00050   /*! 
00051    * @return true if FWPDS outputs a WFA whose transitions have lazy
00052    * weights.returns a lazy automaton.
00053    */
00054   extern bool is_lazy_fwpds();
00055 
00056   /*!
00057    * @brief Enable or disable strictness on transition "to" states.
00058    * @return void
00059    */
00060   extern void set_strict( bool enable );
00061 
00062   /*!
00063    * @return true if WALi is being strict about transitions being
00064    * to a PDS state.
00065    */
00066   extern bool is_strict();
00067 
00068 } // namespace wali
00069 
00070 /*!
00071  * @macro ATTR_UNUSED
00072  *
00073  * This macro disables GCC warnings for unused parameters. #ifdef
00074  * is used b/c MS VC++ does not like __attribute__.
00075  */
00076 #if defined(__GNUC__)
00077 #   define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00078 #   if( GCC_VERSION >= 30400 )
00079 #       define ATTR_UNUSED __attribute__((__unused__))
00080 #   else
00081 #       define ATTR_UNUSED
00082 #   endif
00083 #elif defined(_WIN32)
00084 #   pragma once
00085 #   define ATTR_UNUSED
00086 #   if _MSC_VER > 1000
00087 #       pragma warning(disable: 4786)
00088 #       pragma warning(disable: 4250)
00089 #   endif
00090 #   if !defined(_CPPRTTI)
00091 #       error RTTI is required by WALi.
00092 #   endif
00093 #endif // defined(__GNUC__)
00094 
00095 #endif  // wali_COMMON_GUARD
00096