diff --git a/doc/changelog.qbk b/doc/changelog.qbk index 06c886f..96f38c1 100644 --- a/doc/changelog.qbk +++ b/doc/changelog.qbk @@ -24,7 +24,7 @@ * Fixed [link log.detailed.attributes.timer `timer`] attribute generating incorrect time readings on Windows on heavy thread contention when `QueryPerformanceCounter` API was used. * Fixed a bug in the filter parser that prevented using parsed filters with some attributes. For example, parsed filters didn't work with a string-typed attribute value, if the value was compared to a numeric operand. * Fixed thread id formatting discrepancies between the default sink and formatters. -* Closed tickets: [ticket 8815], [ticket 8819], [ticket 8915], [ticket 8917]. +* Closed tickets: [ticket 8815], [ticket 8819], [ticket 8915], [ticket 8917], [ticket 9139], [ticket 9140], [ticket 9153], [ticket 9155]. [heading 2.1, Boost 1.54] diff --git a/doc/log.qbk b/doc/log.qbk index e35ef0e..1ba92d1 100644 --- a/doc/log.qbk +++ b/doc/log.qbk @@ -166,6 +166,7 @@ The following compilers/platforms are not supported and will likely fail to comp * MSVC 8.0 (without SP1) and older. * GCC 4.0 and older. * Borland C++ 5.5.1 (free version). Newer versions might or might not work. +* Solaris Studio 12.3 and older. * Windows 9x, ME, NT4 and older are not supported. Boost.Log should be compatible with all hardware architectures supported by Boost. However, in case of 32 bit x86 architecture the library requires at least i586 class CPU to run. diff --git a/include/boost/log/attributes/attribute_value_set.hpp b/include/boost/log/attributes/attribute_value_set.hpp index ad9bde5..05aee87 100644 --- a/include/boost/log/attributes/attribute_value_set.hpp +++ b/include/boost/log/attributes/attribute_value_set.hpp @@ -95,6 +95,7 @@ public: private: struct implementation; + friend struct implementation; //! A base class for the container nodes struct node_base diff --git a/include/boost/log/detail/config.hpp b/include/boost/log/detail/config.hpp index d109ab4..e13ce23 100644 --- a/include/boost/log/detail/config.hpp +++ b/include/boost/log/detail/config.hpp @@ -53,8 +53,8 @@ # define BOOST_LOG_BROKEN_TEMPLATE_DEFINITION_MATCHING # endif # if _MSC_VER <= 1400 - // Older MSVC versions reject friend declarations for class template instantiations -# define BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS + // Older MSVC versions reject friend declarations for class template specializations +# define BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS # endif # if _MSC_VER <= 1600 // MSVC up to 10.0 attempts to invoke copy constructor when initializing a const reference from rvalue returned from a function. @@ -78,8 +78,8 @@ # endif #endif -#if defined(BOOST_INTEL) - // Intel compiler has problems with friend declarations for member classes +#if defined(BOOST_INTEL) || defined(__SUNPRO_CC) + // Intel compiler and Sun Studio 12.3 have problems with friend declarations for nested class templates # define BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS #endif @@ -99,16 +99,6 @@ # endif #endif -#if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG) - // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it -# define BOOST_LOG_NO_UNSPECIFIED_BOOL -#endif // (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG) - -#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) - // GCC 4.0.0 (and probably older) can't cope with some optimizations regarding string literals -# define BOOST_LOG_BROKEN_STRING_LITERALS -#endif - #if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 2) // GCC 4.1 and 4.2 have buggy anonymous namespaces support, which interferes with symbol linkage # define BOOST_LOG_ANONYMOUS_NAMESPACE namespace anonymous {} using namespace anonymous; namespace anonymous @@ -154,7 +144,7 @@ // Some compilers support a special attribute that shows that a function won't return #if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590) - // GCC and (supposedly) Sun Studio 12 support attribute syntax + // GCC and Sun Studio 12 support attribute syntax # define BOOST_LOG_NORETURN __attribute__((noreturn)) #elif defined (_MSC_VER) // Microsoft-compatible compilers go here diff --git a/include/boost/log/detail/spin_mutex.hpp b/include/boost/log/detail/spin_mutex.hpp index 0dfb31a..ed9548c 100644 --- a/include/boost/log/detail/spin_mutex.hpp +++ b/include/boost/log/detail/spin_mutex.hpp @@ -78,8 +78,8 @@ extern "C" void _mm_pause(void); # define BOOST_LOG_PAUSE_OP _mm_pause() # endif # if defined(__INTEL_COMPILER) -# define BOOST_LOG_COMPILER_BARRIER __asm { nop } -# elif _MSC_VER >= 1310 +# define BOOST_LOG_COMPILER_BARRIER __memory_barrier() +# else extern "C" void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) # define BOOST_LOG_COMPILER_BARRIER _ReadWriteBarrier() diff --git a/include/boost/log/expressions/formatters/named_scope.hpp b/include/boost/log/expressions/formatters/named_scope.hpp index d6cdd62..b7d8264 100644 --- a/include/boost/log/expressions/formatters/named_scope.hpp +++ b/include/boost/log/expressions/formatters/named_scope.hpp @@ -71,10 +71,17 @@ enum scope_iteration_direction namespace aux { +#ifdef BOOST_LOG_USE_CHAR //! Parses the named scope format string and constructs the formatter function -template< typename CharT > -BOOST_LOG_API boost::log::aux::light_function< void (basic_formatting_ostream< CharT >&, attributes::named_scope::value_type::value_type const&) > -parse_named_scope_format(const CharT* begin, const CharT* end); +BOOST_LOG_API boost::log::aux::light_function< void (basic_formatting_ostream< char >&, attributes::named_scope::value_type::value_type const&) > +parse_named_scope_format(const char* begin, const char* end); +#endif + +#ifdef BOOST_LOG_USE_WCHAR_T +//! Parses the named scope format string and constructs the formatter function +BOOST_LOG_API boost::log::aux::light_function< void (basic_formatting_ostream< wchar_t >&, attributes::named_scope::value_type::value_type const&) > +parse_named_scope_format(const wchar_t* begin, const wchar_t* end); +#endif //! Parses the named scope format string and constructs the formatter function template< typename CharT > diff --git a/include/boost/log/utility/unique_identifier_name.hpp b/include/boost/log/utility/unique_identifier_name.hpp index debd205..9aa6b98 100644 --- a/include/boost/log/utility/unique_identifier_name.hpp +++ b/include/boost/log/utility/unique_identifier_name.hpp @@ -9,13 +9,12 @@ * \author Andrey Semashev * \date 30.04.2008 * - * The header contains BOOST_LOG_UNIQUE_IDENTIFIER_NAME macro definition. + * The header contains \c BOOST_LOG_UNIQUE_IDENTIFIER_NAME macro definition. */ #ifndef BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ #define BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ -#include #include #include @@ -37,16 +36,16 @@ * * Constructs a unique (in the current file scope) token that can be used as a variable name. * The name will contain a prefix passed in the \a prefix argument. This allows to use the - * macro multiple times in another macro. + * macro multiple times on a single line. */ // In VC 7.0 and later when compiling with /ZI option __LINE__ macro is corrupted -#if BOOST_WORKAROUND(BOOST_MSVC, >=1300) +#ifdef BOOST_MSVC # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\ BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __COUNTER__) #else # define BOOST_LOG_UNIQUE_IDENTIFIER_NAME(prefix)\ BOOST_LOG_UNIQUE_IDENTIFIER_NAME_INTERNAL(prefix, __LINE__) -#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1300) +#endif // BOOST_MSVC #endif // BOOST_LOG_UTILITY_UNIQUE_IDENTIFIER_NAME_HPP_INCLUDED_ diff --git a/src/attribute_name.cpp b/src/attribute_name.cpp index 52965a8..0ed2d85 100644 --- a/src/attribute_name.cpp +++ b/src/attribute_name.cpp @@ -49,7 +49,7 @@ class attribute_name::repository : shared_ptr< repository > > base_type; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class log::aux::lazy_singleton< repository, shared_ptr< repository > diff --git a/src/default_attribute_names.cpp b/src/default_attribute_names.cpp index 9bb364c..d442d1a 100644 --- a/src/default_attribute_names.cpp +++ b/src/default_attribute_names.cpp @@ -34,7 +34,7 @@ BOOST_LOG_ANONYMOUS_NAMESPACE { private: typedef lazy_singleton< names, shared_ptr< names > > base_type; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class lazy_singleton< names, shared_ptr< names > >; #else friend class base_type; diff --git a/src/default_sink.cpp b/src/default_sink.cpp index ca19457..88c9328 100644 --- a/src/default_sink.cpp +++ b/src/default_sink.cpp @@ -31,6 +31,8 @@ namespace boost { BOOST_LOG_OPEN_NAMESPACE +#if !defined(BOOST_LOG_NO_THREADS) + namespace aux { // Defined in thread_id.cpp @@ -38,6 +40,8 @@ void format_thread_id(char* buf, std::size_t size, thread::id tid); } // namespace aux +#endif // !defined(BOOST_LOG_NO_THREADS) + namespace sinks { namespace aux { @@ -210,7 +214,7 @@ void default_sink::consume(record_view const& rec) void default_sink::flush() { BOOST_LOG_EXPR_IF_MT(lock_guard< mutex_type > lock(m_mutex);) - fflush(stdout); + std::fflush(stdout); } } // namespace aux diff --git a/src/filter_parser.cpp b/src/filter_parser.cpp index dcd85d6..8054bac 100644 --- a/src/filter_parser.cpp +++ b/src/filter_parser.cpp @@ -73,7 +73,7 @@ struct filters_repository : typedef std::map< attribute_name, shared_ptr< filter_factory_type >, attribute_name_order > factories_map; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class log::aux::lazy_singleton< filters_repository< char_type > >; #else friend class base_type; diff --git a/src/formatter_parser.cpp b/src/formatter_parser.cpp index bac906e..e8736ad 100644 --- a/src/formatter_parser.cpp +++ b/src/formatter_parser.cpp @@ -61,7 +61,7 @@ struct formatters_repository : //! Base class type typedef log::aux::lazy_singleton< formatters_repository< CharT > > base_type; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class log::aux::lazy_singleton< formatters_repository< CharT > >; #else friend class base_type; diff --git a/src/init_from_settings.cpp b/src/init_from_settings.cpp index e1f3c51..0f2e997 100644 --- a/src/init_from_settings.cpp +++ b/src/init_from_settings.cpp @@ -603,7 +603,7 @@ struct sinks_repository : { typedef log::aux::lazy_singleton< sinks_repository< CharT > > base_type; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class log::aux::lazy_singleton< sinks_repository< CharT > >; #else friend class base_type; diff --git a/src/named_scope_format_parser.cpp b/src/named_scope_format_parser.cpp index 6d05c6c..7e87138 100644 --- a/src/named_scope_format_parser.cpp +++ b/src/named_scope_format_parser.cpp @@ -151,12 +151,10 @@ public: } }; -} // namespace - //! Parses the named scope format string and constructs the formatter function template< typename CharT > -boost::log::aux::light_function< void (basic_formatting_ostream< CharT >&, attributes::named_scope::value_type::value_type const&) > -parse_named_scope_format(const CharT* begin, const CharT* end) +BOOST_FORCEINLINE boost::log::aux::light_function< void (basic_formatting_ostream< CharT >&, attributes::named_scope::value_type::value_type const&) > +do_parse_named_scope_format(const CharT* begin, const CharT* end) { typedef CharT char_type; typedef boost::log::aux::light_function< void (basic_formatting_ostream< char_type >&, attributes::named_scope::value_type::value_type const&) > result_type; @@ -217,20 +215,28 @@ parse_named_scope_format(const CharT* begin, const CharT* end) return result_type(boost::move(fmt)); } +} // namespace + #ifdef BOOST_LOG_USE_CHAR -template BOOST_LOG_API -boost::log::aux::light_function< void (basic_formatting_ostream< char >&, attributes::named_scope::value_type::value_type const&) > -parse_named_scope_format(const char* begin, const char* end); +//! Parses the named scope format string and constructs the formatter function +BOOST_LOG_API boost::log::aux::light_function< void (basic_formatting_ostream< char >&, attributes::named_scope::value_type::value_type const&) > +parse_named_scope_format(const char* begin, const char* end) +{ + return do_parse_named_scope_format(begin, end); +} #endif // BOOST_LOG_USE_CHAR #ifdef BOOST_LOG_USE_WCHAR_T -template BOOST_LOG_API -boost::log::aux::light_function< void (basic_formatting_ostream< wchar_t >&, attributes::named_scope::value_type::value_type const&) > -parse_named_scope_format(const wchar_t* begin, const wchar_t* end); +//! Parses the named scope format string and constructs the formatter function +BOOST_LOG_API boost::log::aux::light_function< void (basic_formatting_ostream< wchar_t >&, attributes::named_scope::value_type::value_type const&) > +parse_named_scope_format(const wchar_t* begin, const wchar_t* end) +{ + return do_parse_named_scope_format(begin, end); +} #endif // BOOST_LOG_USE_WCHAR_T diff --git a/src/text_file_backend.cpp b/src/text_file_backend.cpp index 534d7ec..b5f33ae 100644 --- a/src/text_file_backend.cpp +++ b/src/text_file_backend.cpp @@ -571,7 +571,7 @@ BOOST_LOG_ANONYMOUS_NAMESPACE { //! Base type typedef log::aux::lazy_singleton< file_collector_repository, shared_ptr< file_collector_repository > > base_type; -#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_INSTANTIATIONS) +#if !defined(BOOST_LOG_BROKEN_FRIEND_TEMPLATE_SPECIALIZATIONS) friend class log::aux::lazy_singleton< file_collector_repository, shared_ptr< file_collector_repository > >; #else friend class base_type;