From 7802423e063ea02ad74098d9aeb1500234daa5a1 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 24 Dec 2013 14:15:56 +0000 Subject: [PATCH] Guard these files to make sure one gets compiler errors and not just linker errors. git-svn-id: https://svn.dealii.org/trunk@32111 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/boost/iostreams/filter/bzip2.hpp | 95 ++++++++++--------- .../include/boost/iostreams/filter/zlib.hpp | 80 ++++++++-------- 2 files changed, 93 insertions(+), 82 deletions(-) diff --git a/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/bzip2.hpp b/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/bzip2.hpp index bc4b18f04a..0ce4984a1a 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/bzip2.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/bzip2.hpp @@ -1,3 +1,8 @@ +#include +#ifndef DEAL_II_WITH_BZIP2 +# error "You cannot use this header file since your system does not have a complete installation of libbz2" +#endif + // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -14,8 +19,8 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif - -#include + +#include #include // allocator. #include // bad_alloc. #include // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM. @@ -26,16 +31,16 @@ #include #include #include // failure, streamsize. -#include -#include -#include +#include +#include +#include // Must come last. #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable:4251 4231 4660) #endif -#include +#include // Temporary fix. #undef small @@ -55,7 +60,7 @@ BOOST_IOSTREAMS_DECL extern const int ok; BOOST_IOSTREAMS_DECL extern const int run_ok; BOOST_IOSTREAMS_DECL extern const int flush_ok; BOOST_IOSTREAMS_DECL extern const int finish_ok; -BOOST_IOSTREAMS_DECL extern const int stream_end; +BOOST_IOSTREAMS_DECL extern const int stream_end; BOOST_IOSTREAMS_DECL extern const int sequence_error; BOOST_IOSTREAMS_DECL extern const int param_error; BOOST_IOSTREAMS_DECL extern const int mem_error; @@ -77,7 +82,7 @@ const int default_block_size = 9; const int default_work_factor = 30; const bool default_small = false; -} // End namespace bzip2. +} // End namespace bzip2. // // Class name: bzip2_params. @@ -136,14 +141,14 @@ struct bzip2_allocator : private Base { private: typedef typename Base::size_type size_type; public: - BOOST_STATIC_CONSTANT(bool, custom = + BOOST_STATIC_CONSTANT(bool, custom = (!is_same, Base>::value)); typedef typename bzip2_allocator_traits::type allocator_type; static void* allocate(void* self, int items, int size); static void deallocate(void* self, void* address); }; -class BOOST_IOSTREAMS_DECL bzip2_base { +class BOOST_IOSTREAMS_DECL bzip2_base { public: typedef char char_type; protected: @@ -151,7 +156,7 @@ protected: ~bzip2_base(); bzip2_params& params() { return params_; } bool& ready() { return ready_; } - template + template void init( bool compress, bzip2_allocator& alloc ) { @@ -171,10 +176,10 @@ protected: int decompress(); void end(bool compress); private: - void do_init( bool compress, + void do_init( bool compress, #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - bzip2::alloc_func, - bzip2::free_func, + bzip2::alloc_func, + bzip2::free_func, #endif void* derived ); bzip2_params params_; @@ -188,14 +193,14 @@ private: // delegating to the libbzip2 function BZ_bzCompress. // template > -class bzip2_compressor_impl - : public bzip2_base, +class bzip2_compressor_impl + : public bzip2_base, #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) public #endif - bzip2_allocator + bzip2_allocator { -public: +public: bzip2_compressor_impl(const bzip2_params&); bool filter( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end, bool flush ); @@ -211,13 +216,13 @@ private: // delegating to the libbzip2 function BZ_bzDecompress. // template > -class bzip2_decompressor_impl - : public bzip2_base, +class bzip2_decompressor_impl + : public bzip2_base, #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) public #endif - bzip2_allocator -{ + bzip2_allocator +{ public: bzip2_decompressor_impl(bool small = bzip2::default_small); bool filter( const char*& begin_in, const char* end_in, @@ -236,8 +241,8 @@ private: // compression using libbzip2. // template > -struct basic_bzip2_compressor - : symmetric_filter, Alloc> +struct basic_bzip2_compressor + : symmetric_filter, Alloc> { private: typedef detail::bzip2_compressor_impl impl_type; @@ -245,7 +250,7 @@ private: public: typedef typename base_type::char_type char_type; typedef typename base_type::category category; - basic_bzip2_compressor( const bzip2_params& = bzip2::default_block_size, + basic_bzip2_compressor( const bzip2_params& = bzip2::default_block_size, int buffer_size = default_device_buffer_size ); }; BOOST_IOSTREAMS_PIPABLE(basic_bzip2_compressor, 1) @@ -258,8 +263,8 @@ typedef basic_bzip2_compressor<> bzip2_compressor; // decompression using libbzip2. // template > -struct basic_bzip2_decompressor - : symmetric_filter, Alloc> +struct basic_bzip2_decompressor + : symmetric_filter, Alloc> { private: typedef detail::bzip2_decompressor_impl impl_type; @@ -282,9 +287,9 @@ namespace detail { template void* bzip2_allocator::allocate(void* self, int items, int size) -{ +{ size_type len = items * size; - char* ptr = + char* ptr = static_cast(self)->allocate (len + sizeof(size_type) #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) @@ -297,10 +302,10 @@ void* bzip2_allocator::allocate(void* self, int items, int size) template void bzip2_allocator::deallocate(void* self, void* address) -{ +{ char* ptr = reinterpret_cast(address) - sizeof(size_type); size_type len = *reinterpret_cast(ptr) + sizeof(size_type); - static_cast(self)->deallocate(ptr, len); + static_cast(self)->deallocate(ptr, len); } //------------------Implementation of bzip2_compressor_impl-------------------// @@ -324,19 +329,19 @@ bool bzip2_compressor_impl::filter } template -void bzip2_compressor_impl::close() -{ +void bzip2_compressor_impl::close() +{ try { end(true); - } catch (...) { - eof_ = false; + } catch (...) { + eof_ = false; throw; } eof_ = false; } template -inline void bzip2_compressor_impl::init() +inline void bzip2_compressor_impl::init() { bzip2_base::init(true, static_cast&>(*this)); } //------------------Implementation of bzip2_decompressor_impl-----------------// @@ -357,7 +362,7 @@ bool bzip2_decompressor_impl::filter else close(); } - if (!ready()) + if (!ready()) init(); before(src_begin, src_end, dest_begin, dest_end); int result = decompress(); @@ -366,16 +371,16 @@ bool bzip2_decompressor_impl::filter after(src_begin, dest_begin); bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); eof_ = result == bzip2::stream_end; - return true; + return true; } template -void bzip2_decompressor_impl::close() -{ +void bzip2_decompressor_impl::close() +{ try { end(false); - } catch (...) { - eof_ = false; + } catch (...) { + eof_ = false; throw; } eof_ = false; @@ -390,15 +395,15 @@ inline void bzip2_decompressor_impl::init() template basic_bzip2_compressor::basic_bzip2_compressor - (const bzip2_params& p, int buffer_size) - : base_type(buffer_size, p) + (const bzip2_params& p, int buffer_size) + : base_type(buffer_size, p) { } //------------------Implementation of bzip2_decompressor----------------------// template basic_bzip2_decompressor::basic_bzip2_decompressor - (bool small, int buffer_size) + (bool small, int buffer_size) : base_type(buffer_size, small) { } diff --git a/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/zlib.hpp b/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/zlib.hpp index b0327f3cb8..925af57cdd 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/zlib.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/iostreams/filter/zlib.hpp @@ -1,3 +1,9 @@ +#include +#ifndef DEAL_II_WITH_ZLIB +# error "You cannot use this header file since your system does not have a complete installation of zlib" +#endif + + // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -13,12 +19,12 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once -#endif +#endif -#include -#include // streamsize. +#include +#include // streamsize. #include // allocator, bad_alloc. -#include +#include #include // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM. #include // uint*_t #include @@ -28,8 +34,8 @@ #include #include #include // failure, streamsize. -#include -#include +#include +#include #include // Must come last. @@ -37,7 +43,7 @@ # pragma warning(push) # pragma warning(disable:4251 4231 4660) // Dependencies not exported. #endif -#include +#include namespace boost { namespace iostreams { @@ -100,7 +106,7 @@ const int default_mem_level = 8; const bool default_crc = false; const bool default_noheader = false; -} // End namespace zlib. +} // End namespace zlib. // // Class name: zlib_params. @@ -112,13 +118,13 @@ struct zlib_params { // Non-explicit constructor. zlib_params( int level = zlib::default_compression, int method = zlib::deflated, - int window_bits = zlib::default_window_bits, - int mem_level = zlib::default_mem_level, + int window_bits = zlib::default_window_bits, + int mem_level = zlib::default_mem_level, int strategy = zlib::default_strategy, bool noheader = zlib::default_noheader, bool calculate_crc = zlib::default_crc ) : level(level), method(method), window_bits(window_bits), - mem_level(mem_level), strategy(strategy), + mem_level(mem_level), strategy(strategy), noheader(noheader), calculate_crc(calculate_crc) { } int level; @@ -162,22 +168,22 @@ struct zlib_allocator : private Base { private: typedef typename Base::size_type size_type; public: - BOOST_STATIC_CONSTANT(bool, custom = + BOOST_STATIC_CONSTANT(bool, custom = (!is_same, Base>::value)); typedef typename zlib_allocator_traits::type allocator_type; static void* allocate(void* self, zlib::uint items, zlib::uint size); static void deallocate(void* self, void* address); }; -class BOOST_IOSTREAMS_DECL zlib_base { +class BOOST_IOSTREAMS_DECL zlib_base { public: typedef char char_type; protected: zlib_base(); ~zlib_base(); void* stream() { return stream_; } - template - void init( const zlib_params& p, + template + void init( const zlib_params& p, bool compress, zlib_allocator& zalloc ) { @@ -191,9 +197,9 @@ protected: } void before( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end ); - void after( const char*& src_begin, char*& dest_begin, + void after( const char*& src_begin, char*& dest_begin, bool compress ); - int xdeflate(int flush); // Prefix 'x' prevents symbols from being + int xdeflate(int flush); // Prefix 'x' prevents symbols from being int xinflate(int flush); // redefined when Z_PREFIX is defined void reset(bool compress, bool realloc); public: @@ -201,10 +207,10 @@ public: int total_in() const { return total_in_; } int total_out() const { return total_out_; } private: - void do_init( const zlib_params& p, bool compress, + void do_init( const zlib_params& p, bool compress, #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - zlib::xalloc_func, - zlib::xfree_func, + zlib::xalloc_func, + zlib::xfree_func, #endif void* derived ); void* stream_; // Actual type: z_stream*. @@ -221,8 +227,8 @@ private: // delegating to the zlib function deflate. // template > -class zlib_compressor_impl : public zlib_base, public zlib_allocator { -public: +class zlib_compressor_impl : public zlib_base, public zlib_allocator { +public: zlib_compressor_impl(const zlib_params& = zlib::default_compression); ~zlib_compressor_impl(); bool filter( const char*& src_begin, const char* src_end, @@ -257,8 +263,8 @@ private: // compression using zlib. // template > -struct basic_zlib_compressor - : symmetric_filter, Alloc> +struct basic_zlib_compressor + : symmetric_filter, Alloc> { private: typedef detail::zlib_compressor_impl impl_type; @@ -266,7 +272,7 @@ private: public: typedef typename base_type::char_type char_type; typedef typename base_type::category category; - basic_zlib_compressor( const zlib_params& = zlib::default_compression, + basic_zlib_compressor( const zlib_params& = zlib::default_compression, int buffer_size = default_device_buffer_size ); zlib::ulong crc() { return this->filter().crc(); } int total_in() { return this->filter().total_in(); } @@ -281,8 +287,8 @@ typedef basic_zlib_compressor<> zlib_compressor; // decompression using zlib. // template > -struct basic_zlib_decompressor - : symmetric_filter, Alloc> +struct basic_zlib_decompressor + : symmetric_filter, Alloc> { private: typedef detail::zlib_decompressor_impl impl_type; @@ -311,9 +317,9 @@ namespace detail { template void* zlib_allocator::allocate (void* self, zlib::uint items, zlib::uint size) -{ +{ size_type len = items * size; - char* ptr = + char* ptr = static_cast(self)->allocate (len + sizeof(size_type) #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) @@ -326,10 +332,10 @@ void* zlib_allocator::allocate template void zlib_allocator::deallocate(void* self, void* address) -{ +{ char* ptr = reinterpret_cast(address) - sizeof(size_type); size_type len = *reinterpret_cast(ptr) + sizeof(size_type); - static_cast(self)->deallocate(ptr, len); + static_cast(self)->deallocate(ptr, len); } //------------------Implementation of zlib_compressor_impl--------------------// @@ -351,7 +357,7 @@ bool zlib_compressor_impl::filter int result = xdeflate(flush ? zlib::finish : zlib::no_flush); after(src_begin, dest_begin, true); zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); - return result != zlib::stream_end; + return result != zlib::stream_end; } template @@ -370,10 +376,10 @@ zlib_decompressor_impl::~zlib_decompressor_impl() template zlib_decompressor_impl::zlib_decompressor_impl(int window_bits) -{ +{ zlib_params p; p.window_bits = window_bits; - init(p, false, static_cast&>(*this)); + init(p, false, static_cast&>(*this)); } template @@ -400,19 +406,19 @@ void zlib_decompressor_impl::close() { template basic_zlib_compressor::basic_zlib_compressor - (const zlib_params& p, int buffer_size) + (const zlib_params& p, int buffer_size) : base_type(buffer_size, p) { } //------------------Implementation of zlib_decompressor-----------------------// template basic_zlib_decompressor::basic_zlib_decompressor - (int window_bits, int buffer_size) + (int window_bits, int buffer_size) : base_type(buffer_size, window_bits) { } template basic_zlib_decompressor::basic_zlib_decompressor - (const zlib_params& p, int buffer_size) + (const zlib_params& p, int buffer_size) : base_type(buffer_size, p) { } //----------------------------------------------------------------------------// -- 2.39.5