[med-svn] r17408 - in trunk/packages/dcmtk/branches/experimental/debian: . patches
Mathieu Malaterre
malat at moszumanska.debian.org
Mon Jul 7 07:10:46 UTC 2014
Author: malat
Date: 2014-07-07 07:10:46 +0000 (Mon, 07 Jul 2014)
New Revision: 17408
Added:
trunk/packages/dcmtk/branches/experimental/debian/patches/0001-Fixed-OFoptional-by-introducing-OFalign.patch
trunk/packages/dcmtk/branches/experimental/debian/patches/removemd5.patch
Modified:
trunk/packages/dcmtk/branches/experimental/debian/changelog
trunk/packages/dcmtk/branches/experimental/debian/patches/series
trunk/packages/dcmtk/branches/experimental/debian/rules
Log:
new upload
Modified: trunk/packages/dcmtk/branches/experimental/debian/changelog
===================================================================
--- trunk/packages/dcmtk/branches/experimental/debian/changelog 2014-07-04 12:52:58 UTC (rev 17407)
+++ trunk/packages/dcmtk/branches/experimental/debian/changelog 2014-07-07 07:10:46 UTC (rev 17408)
@@ -1,3 +1,10 @@
+dcmtk (3.6.1~20140617-3) experimental; urgency=low
+
+ * Fix building/running on sparc.
+ * Really remove md5 files from doxygen HTML output
+
+ -- Mathieu Malaterre <malat at debian.org> Mon, 07 Jul 2014 09:09:49 +0200
+
dcmtk (3.6.1~20140617-2) experimental; urgency=low
* Fix SIGSEGV on sparc
Added: trunk/packages/dcmtk/branches/experimental/debian/patches/0001-Fixed-OFoptional-by-introducing-OFalign.patch
===================================================================
--- trunk/packages/dcmtk/branches/experimental/debian/patches/0001-Fixed-OFoptional-by-introducing-OFalign.patch (rev 0)
+++ trunk/packages/dcmtk/branches/experimental/debian/patches/0001-Fixed-OFoptional-by-introducing-OFalign.patch 2014-07-07 07:10:46 UTC (rev 17408)
@@ -0,0 +1,1044 @@
+From 21142a1d3354b5d4e97a2e160221ae391362e8c1 Mon Sep 17 00:00:00 2001
+From: Jan Schlamelcher <dicom at offis.de>
+Date: Fri, 4 Jul 2014 12:02:51 +0200
+Subject: [PATCH] Fixed OFoptional by introducing OFalign?
+
+---
+ CMake/GenerateDCMTKConfigure.cmake | 29 +++
+ CMake/osconfig.h.in | 12 +
+ config/aclocal.m4 | 41 +++
+ config/configure | 60 +++++
+ config/configure.in | 2 +
+ config/include/dcmtk/config/osconfig.h.in | 6 +
+ ofstd/include/dcmtk/ofstd/ofalign.h | 190 ++++++++++++++
+ ofstd/include/dcmtk/ofstd/ofoption.h | 390 +++++++++++++++++++----------
+ ofstd/include/dcmtk/ofstd/oftraits.h | 4 +-
+ ofstd/tests/toption.cc | 8 +
+ 10 files changed, 610 insertions(+), 132 deletions(-)
+ create mode 100644 ofstd/include/dcmtk/ofstd/ofalign.h
+
+Index: dcmtk-3.6.1~20140617/CMake/GenerateDCMTKConfigure.cmake
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/CMake/GenerateDCMTKConfigure.cmake 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/CMake/GenerateDCMTKConfigure.cmake 2014-07-07 09:04:24.029706532 +0200
+@@ -687,3 +687,32 @@
+ }
+ ")
+ ENDIF(WIN32)
++
++# Check for alignment query / specifier support
++DCMTK_TRY_COMPILE(HAVE_GNU_ALIGNOF "__alignof__ is supported"
++ "int main()
++{
++ char c[__alignof__(int)];
++ return 0;
++}")
++
++DCMTK_TRY_COMPILE(HAVE_MS_ALIGNOF "__alignof is supported"
++ "int main()
++{
++ char c[__alignof(int)];
++ return 0;
++}")
++
++DCMTK_TRY_COMPILE(HAVE_ATTRIBUTE_ALIGNED "__attribute__((aligned)) is supported"
++ "int main()
++{
++ __attribute__((aligned(4))) char c[16];
++ return 0;
++}")
++
++DCMTK_TRY_COMPILE(HAVE_DECLSPEC_ALIGN "__declspec(align) is supported"
++ "int main()
++{
++ __declspec(align(4)) char c[16];
++ return 0;
++}")
+Index: dcmtk-3.6.1~20140617/CMake/osconfig.h.in
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/CMake/osconfig.h.in 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/CMake/osconfig.h.in 2014-07-07 09:04:24.033706533 +0200
+@@ -1054,4 +1054,16 @@
+ for building with C++11 features.
+ #endif
+
++/* Define if the compiler supports __alignof__ */
++#cmakedefine HAVE_GNU_ALIGNOF
++
++/* Define if the compiler supports __alignof */
++#cmakedefine HAVE_MS_ALIGNOF
++
++/* Define if the compiler supports __attribute__(aligned) */
++#cmakedefine HAVE_ATTRIBUTE_ALIGNED
++
++/* Define if the compiler supports __declspec(align) */
++#cmakedefine HAVE_DECLSPEC_ALIGN
++
+ #endif /* !OSCONFIG_H*/
+Index: dcmtk-3.6.1~20140617/config/aclocal.m4
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/config/aclocal.m4 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/config/aclocal.m4 2014-07-07 09:04:24.033706533 +0200
+@@ -1819,6 +1819,47 @@
+ fi
+ ])
+
++AC_DEFUN([AC_CHECK_ALIGNOF],
++[
++ AC_MSG_CHECKING([for __alignof__])
++ AC_LINK_IFELSE(
++ [
++ AC_LANG_SOURCE(
++ [
++ int main(){char c[__alignof__(int)];return 0;}
++ ])
++ ],
++ [dcmtk_have_alignof=[yes]],
++ [dcmtk_have_alignof=[no]]
++ )
++ if test "$dcmtk_have_alignof" = yes; then
++ AC_MSG_RESULT([yes])
++ AC_DEFINE($1,[1],[Define if __alignof__ is available])
++ else
++ AC_MSG_RESULT([no])
++ fi
++])
++
++AC_DEFUN([AC_CHECK_ATTRIBUTE_ALIGNED],
++[
++ AC_MSG_CHECKING([for __attribute__((aligned))])
++ AC_LINK_IFELSE(
++ [
++ AC_LANG_SOURCE(
++ [
++ int main(){__attribute__((aligned(4))) char c[16];return 0;}
++ ])
++ ],
++ [dcmtk_have_attribute_aligned=[yes]],
++ [dcmtk_have_attribute_aligned=[no]]
++ )
++ if test "$dcmtk_have_attribute_aligned" = yes; then
++ AC_MSG_RESULT([yes])
++ AC_DEFINE($1,[1],[Define if __attribute__((aligned)) is available])
++ else
++ AC_MSG_RESULT([no])
++ fi
++])
+
+ dnl
+ dnl This macro checks if a given preprocessor symbol exists and is a string
+Index: dcmtk-3.6.1~20140617/config/configure
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/config/configure 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/config/configure 2014-07-07 09:04:24.041706533 +0200
+@@ -14369,6 +14369,66 @@
+ fi
+
+
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __alignof__" >&5
++$as_echo_n "checking for __alignof__... " >&6; }
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++
++ int main(){char c__alignof__(int);return 0;}
++
++
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++ dcmtk_have_alignof=yes
++else
++ dcmtk_have_alignof=no
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++ if test "$dcmtk_have_alignof" = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++$as_echo "#define HAVE_GNU_ALIGNOF 1" >>confdefs.h
++
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ fi
++
++
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((aligned))" >&5
++$as_echo_n "checking for __attribute__((aligned))... " >&6; }
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++
++
++ int main(){__attribute__((aligned(4))) char c16;return 0;}
++
++
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++ dcmtk_have_attribute_aligned=yes
++else
++ dcmtk_have_attribute_aligned=no
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++ if test "$dcmtk_have_attribute_aligned" = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++$as_echo "#define HAVE_ATTRIBUTE_ALIGNED 1" >>confdefs.h
++
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ fi
++
++
+ CFLAGS="$DEBUGCFLAGS $CFLAGS"
+ CXXFLAGS="$DEBUGCXXFLAGS $CXXFLAGS"
+
+Index: dcmtk-3.6.1~20140617/config/configure.in
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/config/configure.in 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/config/configure.in 2014-07-07 09:04:24.041706533 +0200
+@@ -1236,6 +1236,8 @@
+
+ AC_CHECK_SYNC_FN([__sync_add_and_fetch],[HAVE_SYNC_ADD_AND_FETCH])
+ AC_CHECK_SYNC_FN([__sync_sub_and_fetch],[HAVE_SYNC_SUB_AND_FETCH])
++AC_CHECK_ALIGNOF([HAVE_GNU_ALIGNOF])
++AC_CHECK_ATTRIBUTE_ALIGNED([HAVE_ATTRIBUTE_ALIGNED])
+
+ dnl -------------------------------------------------------
+ dnl Set optimizer and debug compiler flags
+Index: dcmtk-3.6.1~20140617/config/include/dcmtk/config/osconfig.h.in
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/config/include/dcmtk/config/osconfig.h.in 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/config/include/dcmtk/config/osconfig.h.in 2014-07-07 09:04:24.041706533 +0200
+@@ -72,6 +72,9 @@
+ /* Define to 1 if you have the <assert.h> header file. */
+ #undef HAVE_ASSERT_H
+
++/* Define if __attribute__((aligned)) is available */
++#undef HAVE_ATTRIBUTE_ALIGNED
++
+ /* Define to 1 if you have the `bcmp' function. */
+ #undef HAVE_BCMP
+
+@@ -252,6 +255,9 @@
+ /* Define to 1 if you have the `gmtime_r' function. */
+ #undef HAVE_GMTIME_R
+
++/* Define if __alignof__ is available */
++#undef HAVE_GNU_ALIGNOF
++
+ /* Define to 1 if you have the <grp.h> header file. */
+ #undef HAVE_GRP_H
+
+Index: dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/ofalign.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/ofalign.h 2014-07-07 09:04:24.045706533 +0200
+@@ -0,0 +1,190 @@
++/*
++ *
++ * Copyright (C) 2014, OFFIS e.V.
++ * All rights reserved. See COPYRIGHT file for details.
++ *
++ * This software and supporting documentation were developed by
++ *
++ * OFFIS e.V.
++ * R&D Division Health
++ * Escherweg 2
++ * D-26121 Oldenburg, Germany
++ *
++ *
++ * Module: ofstd
++ *
++ * Author: Jan Schlamelcher
++ *
++ * Purpose: Implement alignment specifiers / query operators
++ * similar to C++11's alignas and alignof.
++ *
++ */
++
++#ifndef OFALIGN_H
++#define OFALIGN_H
++
++#include "dcmtk/config/osconfig.h"
++#include "dcmtk/ofstd/oftypes.h"
++
++// use native functionality if C++11 is supported
++#ifdef DCMTK_ENABLE_CXX11
++
++#define OFalignof alignof
++#define OFalignas alignas
++
++#elif !defined(DOXYGEN) // fallback implementations
++
++// alignof
++#ifdef HAVE_GNU_ALIGNOF
++#define OFalignof __alignof__
++#elif defined(HAVE_MS_ALIGNOF)
++#define OFalignof __alignof
++#endif
++
++// these helper templates automatically resolve the alignment
++// if a type is given and pass-through any numeric constant
++template<size_t Size>
++struct OFalignas_size_helper { Uint8 size[Size]; };
++template<typename T>
++OFalignas_size_helper
++<
++#ifdef OFalignof
++ OFalignof(T)
++#else // use sizeof instead
++ sizeof(T)
++#endif
++> OFalignof_or_identity() {}
++template<size_t Size>
++OFalignas_size_helper<Size> OFalignof_or_identity() {}
++
++// alignas
++#ifdef HAVE_ATTRIBUTE_ALIGNED
++
++#define OFalignas(A) __attribute__((aligned(sizeof(OFalignof_or_identity<A>()))))
++
++#elif defined(HAVE_DECLSPEC_ALIGN)
++
++// Microsoft workaround: align + align_like
++// __declspec(align) does not understand integral expressions
++// but instead requires an integral literal, Microsoft says:
++// "Valid entries are integer powers of two from 1 to 8192 (bytes),
++// such as 2, 4, 8, 16, 32, or 64."
++// So this is fundamentally different to the real alignment specifiers
++// from GNU and C++11.
++#define OFalign(T,A) OFdeclspec_align<T>::template as<sizeof(OFalignof_or_identity<A>())>::type
++
++// The trick / hack: specialize a template for every valid
++// integral expression and use an appropriate integral literal to
++// define the desired type. At least Microsoft allows us to
++// typedef this stuff, but the API is still fundamentally different
++// to the favored "OFalignas".
++// This also requires a specialization for arrays, since making
++// an array from an aligned type is not the same as making an
++// aligned array.
++#define DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( N )\
++template<typename T>\
++struct make_type<T,N> { typedef __declspec(align(N)) T type; };\
++template<typename T,size_t S>\
++struct make_type<T[S],N> { typedef __declspec(align(N)) T type[S]; }
++
++template<typename X>
++class OFdeclspec_align
++{
++ template<typename T,size_t>
++ struct make_type { typedef T type; };
++ template<typename T,size_t S,size_t A>
++ struct make_type<T[S],A> { typedef T type[S]; };
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 1 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 2 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 4 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 8 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 16 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 32 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 64 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 128 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 256 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 512 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 1024 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 2048 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 4096 );
++ DCMTK_OFALIGN_HACK_CONSTANT_BY_SPECIALIZATION( 8192 );
++
++public:
++ template<size_t A>
++ struct as { typedef OFTypename make_type<X,A>::type type; };
++};
++#endif
++
++#else // DOXYGEN
++
++/** @file ofalign.h
++ * Implements platform independent alignment, if possible similar to
++ * C++11's alignof / alignas functionality.
++ */
++
++/** Determine the alignment of a type T.
++ * @note OFalignof may not be available on your platform / compiler combination.
++ * Use <kbd>#ifdef OFalignof</kbd> to query availability.
++ * @details OFalignof behaves similar to
++ * <a href="http://en.cppreference.com/w/cpp/language/alignof">C++11's alignof</a>
++ * when it's supported.
++ */
++#define OFalignof <unspecified>
++
++/** Align object or class like another type or as specified by an integral expression.
++ * @note OFalignas may not be available on your platform / compiler combination.
++ * Use <kbd>#ifdef OFalignas</kbd> to query availability. See OFalign for an alternative
++ * with limited functionality that supports more platforms in return.
++ * @details OFalignas behaves similar to
++ * <a href="http://en.cppreference.com/w/cpp/language/alignas">C++11's alignas</a>
++ * when it's supported.
++ */
++#define OFalignas <unspecified>
++
++/** Determine a type with modified alignment for a given type T.
++ * @note OFalign may not be available on your platform / compiler combination.
++ * Use <kbd>#ifdef OFalign</kbd> to query availability.
++ * @details
++ * OFalign can be though of as the least common denominator of the alignment capabilities
++ * available on different platform / compiler combinations. Given a type T and an integral
++ * expression I, <kbd>OFalign(T,I)</kbd> evaluates to an appropriately aligned type corresponding
++ * to T.<br>
++ * You may also use another type to specify the desired alignment, e.g. <kbd>OFalign(T,int)</kbd>.
++ * OFalign will then calculate the alignment using <i>OFalignof</i> (if available) or use
++ * <i>sizeof()</i> as approximation.<br>
++ * To align arrays via OFalign, simply pass the array's extents within the parameter, e.g.
++ * <kbd>OFalign(char[12],float)</kbd> to align an array containing <i>12</i> chars like a float.<br>
++ * When using OFalign inside a dependant scope (i.e. inside templates), you may need
++ * to use OFTypename in conjunction with OFalign, e.g.
++ * @code typedef OFTypename OFalign(T,16) value_type; @endcode
++ * OFalign should support alignments as any power of two <= 8192 (examine your compiler's manual
++ * when in doubt).
++ * Other alignments may also be supported, but may not be available on every platform.
++ * OFalign may simply ignore your request if you specify an unsupported aligment
++ * (won't output an error). You may want to check the alignment via <i>OFalignof</i> in case
++ * it is likely to fail. Using another type as alignment specifier should always work,
++ * as the required alignment is obviously supported in that case
++ * (at least when OFalignof is available).
++ */
++#define OFalign <unspecified>
++
++#endif // C++11
++
++#if defined(OFalignas) && !defined(DOXYGEN)
++// OFalign based on OFalignas, so this is "platform-independent".
++#define OFalign(T,A) OFalignas_align<T>::template as<sizeof(OFalignof_or_identity<A>())>::type
++template<typename T>
++struct OFalignas_align
++{
++ template<size_t A>
++ struct as { typedef OFalignas(A) T type; };
++};
++template<typename T,size_t S>
++struct OFalignas_align<T[S]>
++{
++ template<size_t A>
++ struct as { typedef OFalignas(A) T type[S]; };
++};
++#endif
++
++#endif // OFALIGN_H
+Index: dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/ofoption.h
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/ofstd/include/dcmtk/ofstd/ofoption.h 2014-07-07 09:04:02.545705242 +0200
++++ dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/ofoption.h 2014-07-07 09:04:24.045706533 +0200
+@@ -29,6 +29,7 @@
+ #include "dcmtk/ofstd/ofstream.h"
+ #include "dcmtk/ofstd/ofdefine.h"
+ #include "dcmtk/ofstd/oftraits.h"
++#include "dcmtk/ofstd/ofalign.h"
+
+ // include <type_traits> for "std::is_default_constructible"
+ // to recover from compiler insanity (Visual Studio 12+).
+@@ -81,6 +82,210 @@
+ OFnullpt_t OFnullopt;
+ #endif // DOXYGEN
+
++/** Default storage traits of OFoptional<T>.
++ * OFdefault_optional_traits manages the state and storage of the contained
++ * object in a portable manner. You may use this class as base when defining
++ * custom traits for a specific type T, so you won't have to re-implement
++ * this functionality entirely.
++ * @relates OFoptional
++ * @tparam T the content type of the respective OFoptional instance.
++ * @sa OFoptional
++ * @sa OFoptional_traits
++ * @details
++ * <h2>@anchor ofoptional_trait_override Example</h2>
++ * This example shows how to override the <i>is_default_constructible</i>
++ * attribute of <kbd>OFoptional_traits</kbd> for the custom class <i>Test</i>.
++ * @code
++ * // Note: Test's default constructor is private
++ * // which leads to errors when being used within
++ * // OFoptional, since a default constructor exists
++ * // but can't be accessed.
++ * class Test
++ * {
++ * Test() {}
++ * public:
++ * static OFoptional<T> instance();
++ * .
++ * .
++ * .
++ * };
++ *
++ * // Override OFoptional's behavior to fix this problem
++ * template<>
++ * struct OFoptional_traits<Test>
++ * : OFdefault_optional_traits<Test> // derived from default traits
++ * {
++ * // Tell OFoptional that it can't default-construct
++ * // a Test object.
++ * typedef OFfalse_type is_default_constructible;
++ * };
++ * @endcode
++ */
++template<typename T>
++class OFdefault_optional_traits
++{
++#ifndef DOXYGEN
++ // types for detecting T's default constructibility via sfinae
++ struct no_type {};
++ struct yes_type {double d;};
++#ifndef _MSC_VER
++ // helper class to create an argument out of size_t
++ template<size_t>
++ struct consume{};
++ // sfinae overload working for default constructible Xs
++ template<typename X>
++ static yes_type sfinae(consume<sizeof *new X>*);
++#elif _MSC_VER < 1700
++ // Workaround bug in Visual Studio.
++ // On these broken compilers, the argument is not evaluated
++ // unless we require them to evaluate it for choosing which
++ // specialization should be instantiated.
++ template<size_t,size_t>
++ struct consume{};
++ template<size_t X>
++ struct consume<X,X> { typedef void type; };
++ // sfinae overload working for value-initializable Xs, that's as
++ // close as we get on these broken compilers
++ template<typename X>
++ static yes_type sfinae(typename consume<sizeof X(),sizeof X()>::type*);
++#else
++ // Visual Stuio 2012 is completely broken, but it has std::is_defaul_constructible
++ // Note: this tests constructibility, but not if WE can construct this.
++ template<typename X>
++ static yes_type sfinae(typename OFenable_if<std::is_default_constructible<X>::value>::type*);
++#endif
++ // most general sfinae overload, chosen only if everything else fails
++ template<typename X>
++ static no_type sfinae(...);
++
++public:
++ struct is_default_constructible
++ : OFintegral_constant<OFBool,sizeof(sfinae<T>(OFnullptr)) == sizeof(yes_type)> {};
++
++#ifdef DCMTK_USE_CXX11_STL
++
++ template<typename... Args>
++ void construct( Args&&... args )
++ { new (content()) T( std::forward<Args>( args )... ); m_State = OFTrue; }
++
++#else // C++11
++
++#ifdef OFalign
++ void construct() { new (content()) T; m_State = OFTrue; }
++ template<typename X>
++ void construct( const X& x ) { new (content()) T( x ); m_State = OFTrue; }
++#else
++ void construct() { m_pContent = new T; }
++ template<typename X>
++ void construct( const X& x ) { m_pContent = new T( x ); }
++#endif
++
++#endif // NOT C++11
++
++#ifdef OFalign
++ // State and content are stored in the same data-array to
++ // optimize alignment and so on. Mutable, since the content
++ // itself can be modified even if it cant be (re-)assigned.
++ OFdefault_optional_traits() : m_State( OFFalse ) {}
++ void destroy() { OFstatic_cast( T*, content() )->~T(); m_State = OFFalse; }
++ OFBool state() const { return m_State; }
++ void* content() const { return m_Content; }
++ mutable OFTypename OFalign(Uint8[sizeof(T)],T) m_Content;
++ OFBool m_State;
++#else
++ // Allocate content on the heap.
++ OFdefault_optional_traits() : m_pContent( OFnullptr ) {}
++ void destroy() { delete m_pContent; m_pContent = OFnullptr; }
++ OFBool state() const { return m_pContent; }
++ void* content() const { return m_pContent; }
++ T* m_pContent;
++#endif
++
++#endif // NOT DOXYGEN
++};
++
++/** Manages storage and state of the object contained in OFoptional<T>.
++ * OFoptional_traits is a customization point for OFoptional that enables you to define a custom storage management policy for
++ * individual types T. If you don't want to implement everything from scratch, use OFdefault_optional_traits as base class for
++ * your implementation.
++ * @relates OFoptional
++ * @tparam the content type of the respective OFoptional instance.
++ * @sa OFoptional
++ * @sa OFdefault_optional_traits
++ * @details
++ * <h2>Example</h2>
++ * The following example shows how to implement custom OFoptional_traits for an enum that already contains a specific element
++ * to denote an invalid state.
++ * @code
++ * enum FILE_ACCESS
++ * {
++ * NONE = 0000,
++ * READ = 0400,
++ * WRITE = 0200,
++ * . . .
++ * INVALID_ACCESS_CODE = 01000
++ * };
++ *
++ * template<>
++ * struct OFoptional_traits<FILE_ACCESS>
++ * {
++ * // Tell OFoptional that this is default-constructible
++ * typedef OFtrue_type is_default_constructible;
++ * // Initialize storage to the invalid state during construction
++ * OFoptional_traits() : access( INVALID_ACCESS_CODE ) {}
++ * // Constructors
++ * void construct() { access = NONE; }
++ * void construct( FILE_ACCESS fa ) { access = fa; }
++ * // There is nothing to destroy, just set the state to "disengaged"
++ * void destroy() { access = INVALID_ACCESS_CODE; }
++ * // Tell OFoptional how to distinguish "engaged" and "disengaged" FILE_ACCESS objects
++ * OFBool state() const { return access != INVALID_ACCESS_CODE; }
++ * // Just return a pointer to the underlying object
++ * void* content() const { return &access; }
++ * // The actual object
++ * mutable FILE_ACCESS access;
++ * };
++ *
++ * COUT << "This should now be the same: " << sizeof( FILE_ACCESS ) << ' ' << sizeof( OFoptional<FILE_ACCESS> ) << OFendl;
++ * @endcode
++ */
++template<typename T>
++struct OFoptional_traits
++#ifndef DOXYGEN
++: OFdefault_optional_traits<T>
++#endif
++{
++#ifdef DOXYGEN
++ /** <b>Required</b>: default construction policy.
++ * You need to define an appropriate integral constant as "is_default_constructible"
++ * that denotes if OFoptional<T> may attempt to default construct the underlying object
++ * under certain circumstances. You may use <kbd>OFdefault_optional_traits<T>::is_default_constructible</kbd>
++ * to specify this member, which uses SFINAE mechanisms to query a type's default constructibility.
++ */
++ <unspecified> is_default_constructible;
++
++ /// <b>Requried</b>: default constructor, must initialize the state to "disengaged".
++ OFoptional_traits();
++
++ /** <b>Required</b>: type constructors, construct the contained object.
++ * You need to define at least one method of this kind, that takes appropriate
++ * parameter(s) to construct the underlying object. Must set the state to "engaged".
++ * If <kbd>is_default_constructible</kbd> evaluates to <i>OFTrue</i>, an overload
++ * taking zero arguments is also required.
++ */
++ void construct(...);
++
++ /// <b>Required</b>: type destructor, destroys the underlying object and must set the state to "disengaged".
++ void destroy();
++
++ /// <b>Required</b>: state query, must return <i>OFTrue</i> when "engaged" and <i>OFFalse</i> otherwhise.
++ OFBool state() const;
++
++ /// <b>Required</b>: content access, must return a pointer to the contained object.
++ void* content() const;
++#endif
++};
++
+ /** The class template OFoptional manages an optional contained value, i.e.\ a value tagged with a state that reports its validity.
+ * A common use case for OFoptional is the return value of a function that may fail. OFoptional handles expensive to construct
+ * objects well and is more readable, as the intent is expressed explicitly.
+@@ -90,8 +295,10 @@
+ * @tparam T the type of the value to manage initialization state for. The type's destructor must be accessible by OFoptional<T>.
+ * @note There exists a sufficient specialization for reference types (T&) that behaves exactly like a pointer (T*) but allows
+ * OFoptional to be used in a generic context (when it's unknown if T is a reference or not).
++ * @sa OFoptional_traits
++ * @sa OFdefault_optional_traits
+ * @details
+- * ### @anchor optional_syntax %OFoptional Syntax ###
++ * <h2>@anchor optional_syntax %OFoptional Syntax</h2>
+ * OFoptional can be used like a pointer to the contained value, except OFoptional also manages the contained value's storage.
+ * Several operators have been overloaded to simplify the usage of OFoptional. Instead of looking at every overload's specification,
+ * it is more appropriate to describe the possible syntax in a general manner. Therefore we declare the following symbols that are
+@@ -147,7 +354,8 @@
+ * @note Detecting if T is default constructible within OFoptional<T> does not work correctly on all
+ * compilers. Especially all versions of Microsoft Visual Studio are impaired. For example a private
+ * default constructor of T might be detected as <i>not accessible</i> although OFoptional<T>
+- * was declared a friend of T.
++ * was declared a friend of T. Specialize <kbd>OFoptional_traits</kbd> for a particular type T to
++ * override constructibility detection as required. See @ref ofoptional_trait_override "this example".
+ * </td>
+ * </tr>
+ * <tr>
+@@ -285,40 +493,11 @@
+ */
+ template<typename T>
+ class OFoptional
+-{
+ #ifndef DOXYGEN
+- // types for detecting T's default constructibility via sfinae
+- struct no_type {};
+- struct yes_type {double d;};
+-#ifndef _MSC_VER
+- // helper class to create an argument out of size_t
+- template<size_t>
+- struct consume{};
+- // sfinae overload working for default constructible Xs
+- template<typename X>
+- static yes_type sfinae(consume<sizeof *new X>*);
+-#elif _MSC_VER < 1700
+- // Workaround bug in Visual Studio.
+- // On these broken compilers, the argument is not evaluated
+- // unless we require them to evaluate it for choosing which
+- // specialization should be instantiated.
+- template<size_t,size_t>
+- struct consume{};
+- template<size_t X>
+- struct consume<X,X> { typedef void type; };
+- // sfinae overload working for value-initializable Xs, that's as
+- // close as we get on these broken compilers
+- template<typename X>
+- static yes_type sfinae(typename consume<sizeof X(),sizeof X()>::type*);
+-#else
+- // Visual Stuio 2012 is completely broken, but it has std::is_defaul_constructible
+- // Note: this tests constructibility, but not if WE can construct this.
+- template<typename X>
+- static yes_type sfinae(typename OFenable_if<std::is_default_constructible<X>::value>::type*);
++: OFoptional_traits<T>
+ #endif
+- // most general sfinae overload, chosen only if everything else fails
+- template<typename X>
+- static no_type sfinae(...);
++{
++#ifndef DOXYGEN
+ // create a matching istream type if condition is OFTrue
+ template<typename Char,typename Traits,OFBool>
+ struct if_istream{ typedef STD_NAMESPACE basic_istream<Char,Traits>& type; };
+@@ -327,15 +506,9 @@
+ struct if_istream<Char,Traits,OFFalse> {};
+ // use sfinae etc. to enable / disable the respective istream operator overloads
+ template<typename Char,typename Traits>
+- struct if_constructible : if_istream<Char,Traits,sizeof(sfinae<T>(OFnullptr)) == sizeof(yes_type)> {};
++ struct if_constructible : if_istream<Char,Traits,OFoptional_traits<T>::is_default_constructible::value> {};
+ template<typename Char,typename Traits>
+- struct if_not_constructible : if_istream<Char,Traits,sizeof(sfinae<T>(OFnullptr)) == sizeof(no_type)> {};
+-
+-// implement "construct" when "emplace" is not supported
+-// needed for the istream operator
+-#ifndef DCMTK_USE_CXX11_STL
+- void construct() { state() = 1; new (content()) T; }
+-#endif // C++11
++ struct if_not_constructible : if_istream<Char,Traits,!OFoptional_traits<T>::is_default_constructible::value> {};
+
+ public:
+ // generic output stream operator overload
+@@ -354,11 +527,7 @@
+ {
+ if( !opt )
+ {
+-#ifdef DCMTK_USE_CXX11_STL
+- opt.emplace();
+-#else // C++11
+ opt.construct();
+-#endif // NOT C++11
+ if( (is >> *opt).fail() )
+ opt = OFnullopt;
+ return is;
+@@ -539,14 +708,14 @@
+
+ // Default construct an OFoptional object in the disengaged state.
+ OFconstexpr OFoptional()
+- : m_Content()
++ : OFoptional_traits<T>()
+ {
+
+ }
+
+ // Explicitly construct a disengaged OFoptional object.
+ OFconstexpr OFoptional( OFnullopt_t )
+- : m_Content()
++ : OFoptional_traits<T>()
+ {
+
+ }
+@@ -561,44 +730,39 @@
+
+ }
+ #else // C++11
+- : m_Content()
++ : OFoptional_traits<T>()
+ {
+- state() = rhs.state();
+- if( state() )
+- new (content()) T( *rhs );
++ if( rhs.state() )
++ OFoptional_traits<T>::construct( *rhs );
+ }
+ #endif // NOT C++11
+
+ // Copy the engaged state from rhs and its contents if rhs is engaged.
+ OFoptional( const OFoptional& rhs )
+- : m_Content()
++ : OFoptional_traits<T>()
+ {
+- state() = rhs.state();
+- if( state() )
+- new (content()) T( *rhs );
++ if( rhs.state() )
++ OFoptional_traits<T>::construct( *rhs );
+ }
+
+ #ifdef DCMTK_USE_CXX11_STL
+ // Move constructor, kills rhs if it was engaged before.
+ OFoptional( OFoptional&& rhs )
+- : m_Content{}
++ : OFoptional_traits<T>()
+ {
+- state() = rhs.state();
+- if( state() )
++ if( rhs.state() )
+ {
+- new (content()) T( std::move( *rhs ) );
+- rhs.state() = 0;
+- rhs->~T();
++ OFoptional_traits<T>::construct( std::move( *rhs ) );
++ rhs.destroy();
+ }
+ }
+
+ // Variadic constructor that emplaces the content
+ template<typename... Args>
+ OFoptional( Args&&... args )
+- : m_Content{}
++ : OFoptional_traits<T>()
+ {
+- state() = 1;
+- new (content()) T( std::forward<Args>( args )... );
++ OFoptional_traits<T>::construct( std::forward<Args>( args )... );
+ }
+
+ // Move assignment
+@@ -609,25 +773,22 @@
+ {
+ // if both objects are engaged, move content
+ // and kill rhs
+- if( state() == rhs.state() )
++ if( OFoptional_traits<T>::state() == rhs.state() )
+ {
+- if( state() )
++ if( OFoptional_traits<T>::state() )
+ {
+ (**this) = std::move( *rhs );
+- rhs.state() = 0;
+- rhs->~T();
++ rhs.destroy();
+ }
+ }
+- else if( state() ) // suicide if engaged and rhs isn't
++ else if( OFoptional_traits<T>::state() ) // suicide if engaged and rhs isn't
+ {
+- state() = 0;
+- (*this)->~T();
++ OFoptional_traits<T>::destroy();
+ }
+ else // if rhs is engaged and we aren't, swap states, move contents and kill rhs.
+ {
+- OFswap( state(), rhs.state() );
+- new (content()) T( std::move( *rhs ) );
+- rhs->~T();
++ OFoptional_traits<T>::construct( std::move( *rhs ) );
++ rhs.destroy();
+ }
+ }
+ return *this;
+@@ -638,34 +799,27 @@
+ OFoptional& emplace( Args&&... args )
+ {
+ // emplace construct if we are disengaged
+- if( !state() )
+- {
+- state() = 1;
+- new (content()) T( std::forward<Args>( args )... );
+- }
+- else (**this) = T( std::forward<Args>( args )... ); // only emplace new content
++ if( !OFoptional_traits<T>::state() )
++ OFoptional_traits<T>::construct( std::forward<Args>( args )... );
++ else
++ (**this) = T( std::forward<Args>( args )... ); // only emplace new content
+ return *this;
+ }
+ #else // C++11
+ // Construct an engaged OFoptional object containing a copy of x.
+ template<typename X>
+ OFoptional( const X& x )
+- : m_Content()
++ : OFoptional_traits<T>()
+ {
+- state() = 1;
+- new (content()) T( x );
++ OFoptional_traits<T>::construct( x );
+ }
+ #endif // NOT C++11
+
+ // Destroy the contained object if engaged, otherwise do nothing.
+ ~OFoptional()
+ {
+- if( state() )
+-#ifndef _MSC_VER
+- (*this)->~T();
+-#else // Workaround bug in Microsoft compilers
+- operator->()->~T();
+-#endif
++ if( OFoptional_traits<T>::state() )
++ OFoptional_traits<T>::destroy();
+ }
+
+ // False friend of the assignment operator to prevent wrong behavior
+@@ -682,23 +836,17 @@
+ if( &rhs != this )
+ {
+ // if both objects are engaged, copy content
+- if( state() == rhs.state() )
++ if( OFoptional_traits<T>::state() == rhs.state() )
+ {
+- if( state() ) (**this) = *rhs;
++ if( OFoptional_traits<T>::state() ) (**this) = *rhs;
+ }
+- else if( state() ) // suicide if engaged and rhs isn't
++ else if( OFoptional_traits<T>::state() ) // suicide if engaged and rhs isn't
+ {
+- state() = 0;
+-#ifndef _MSC_VER
+- (*this)->~T();
+-#else // Workaround bug in Microsoft compilers
+- operator->()->~T();
+-#endif
++ OFoptional_traits<T>::destroy();
+ }
+ else // if rhs is engaged and we aren't, copy-construct from rhs.
+ {
+- state() = 1;
+- new (content()) T( *rhs );
++ OFoptional_traits<T>::construct( *rhs );
+ }
+ }
+ return *this;
+@@ -712,66 +860,48 @@
+ #endif // C++11
+ operator OFBool() const
+ {
+- return state() != 0;
++ return OFoptional_traits<T>::state();
+ }
+
+ OFBool operator!() const
+ {
+- return !state();
++ return !OFoptional_traits<T>::state();
+ }
+
+ T& operator*() const
+ {
+- return *static_cast<T*>( content() );
++ return *OFstatic_cast( T*, OFoptional_traits<T>::content() );
+ }
+
+ T* operator->() const
+ {
+- return static_cast<T*>( content() );
++ return OFstatic_cast( T*, OFoptional_traits<T>::content() );
+ }
+
+ // Swap the contents with another OFoptional object.
+ void swap( OFoptional& rhs )
+ {
+ // if both objects are engaged, the contents are swapped.
+- if( state() == rhs.state() )
++ if( OFoptional_traits<T>::state() == rhs.state() )
+ {
+- if( state() ) OFswap( **this, *rhs );
++ if( OFoptional_traits<T>::state() ) OFswap( **this, *rhs );
+ }
+ else
+ {
+ // if we are engaged and rhs isn't, move assign
+ // our contents to rhs.
+- if( state() )
++ if( OFoptional_traits<T>::state() )
+ {
+- new (rhs.content()) T( OFmove( **this ) );
+-#ifndef _MSC_VER
+- (*this)->~T();
+-#else // Workaround bug in Microsoft compilers
+- operator->()->~T();
+-#endif
++ rhs.construct( OFmove( **this ) );
++ OFoptional_traits<T>::destroy();
+ }
+ else // else move assign rhs' contents to us
+ {
+- new (content()) T( OFmove( *rhs ) );
+-#ifndef _MSC_VER
+- rhs->~T();
+-#else // Workaround bug in Microsoft compilers
+- rhs.operator->()->~T();
+-#endif
++ OFoptional_traits<T>::construct( OFmove( *rhs ) );
++ rhs.destroy();
+ }
+- // finally, swap the states
+- OFswap( state(), rhs.state() );
+ }
+ }
+-
+-private:
+- // State and content are stored in the same data-array to
+- // optimize alignment and so on. Mutable, since the content
+- // itself can be modified even if it cant be (re-)assigned.
+- void* content() const { return m_Content; }
+- Uint8& state() const { return m_Content[sizeof(T)]; }
+- mutable Uint8 m_Content[sizeof(T)+1];
+ #endif // NOT DOXYGEN
+ };
+
+Index: dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/oftraits.h
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/ofstd/include/dcmtk/ofstd/oftraits.h 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/ofstd/include/dcmtk/ofstd/oftraits.h 2014-07-07 09:04:24.045706533 +0200
+@@ -37,8 +37,8 @@
+ template<bool B,typename... ARGS>
+ using OFconditional = std::conditional<B,ARGS...>;
+
+-template<typename... ARGS>
+-using OFintegral_constant = std::integral_constant<ARGS...>;
++template<typename T,T Value>
++using OFintegral_constant = std::integral_constant<T,Value>;
+
+ template<typename... ARGS>
+ using OFis_signed = std::is_signed<ARGS...>;
+Index: dcmtk-3.6.1~20140617/ofstd/tests/toption.cc
+===================================================================
+--- dcmtk-3.6.1~20140617.orig/ofstd/tests/toption.cc 2014-06-17 11:23:18.000000000 +0200
++++ dcmtk-3.6.1~20140617/ofstd/tests/toption.cc 2014-07-07 09:04:24.045706533 +0200
+@@ -10,8 +10,16 @@
+
+ OFTEST(ofstd_optional)
+ {
++ OFCHECK( OFoptional_traits<int>::is_default_constructible::value );
++ OFCHECK( !OFoptional_traits<test>::is_default_constructible::value );
++
+ OFoptional<int> o0( 3 ), o1, o2( OFnullopt );
+
++ COUT << OFalignof(OFoptional<char>) << ' ' << sizeof(OFoptional<char>) << OFendl;
++ COUT << OFalignof(OFoptional<short>) << ' ' << sizeof(OFoptional<short>) << OFendl;
++ COUT << OFalignof(OFoptional<float>) << ' ' << sizeof(OFoptional<float>) << OFendl;
++ COUT << OFalignof(long) << ' ' << sizeof(long) << ' ' << OFalignof(OFoptional<long>) << ' ' << sizeof(OFoptional<long>) << OFendl;
++
+ OFCHECK( o0 && *o0 == 3 );
+
+ OFCHECK( !o1 && !o2 );
Added: trunk/packages/dcmtk/branches/experimental/debian/patches/removemd5.patch
===================================================================
--- trunk/packages/dcmtk/branches/experimental/debian/patches/removemd5.patch (rev 0)
+++ trunk/packages/dcmtk/branches/experimental/debian/patches/removemd5.patch 2014-07-07 07:10:46 UTC (rev 17408)
@@ -0,0 +1,15 @@
+Description: Remove md5 files. They only serves as internal bookeeping mecanism
+ for doxygen
+Author: Mathieu Malaterre <malat at debian.org>
+
+--- dcmtk-3.6.1~20140617.orig/doxygen/CMakeLists.txt
++++ dcmtk-3.6.1~20140617/doxygen/CMakeLists.txt
+@@ -40,7 +40,7 @@ IF(DCMTK_WITH_DOXYGEN)
+ ENDIF(NOT WIN32)
+
+ # install html docs and manpages
+- INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/htmldocs/ DESTINATION ${DCMTK_INSTALL_HTMDIR} COMPONENT html PATTERN "CVS" EXCLUDE)
++ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/htmldocs/ DESTINATION ${DCMTK_INSTALL_HTMDIR} COMPONENT html PATTERN "*.md5" EXCLUDE)
+ IF(DCMTK_GENERATE_DOXYGEN_TAGFILE)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DOXYGEN_TAGFILE} DESTINATION ${DCMTK_INSTALL_DOCDIR} COMPONENT html OPTIONAL)
+ ENDIF(DCMTK_GENERATE_DOXYGEN_TAGFILE)
Modified: trunk/packages/dcmtk/branches/experimental/debian/patches/series
===================================================================
--- trunk/packages/dcmtk/branches/experimental/debian/patches/series 2014-07-04 12:52:58 UTC (rev 17407)
+++ trunk/packages/dcmtk/branches/experimental/debian/patches/series 2014-07-07 07:10:46 UTC (rev 17408)
@@ -8,4 +8,5 @@
#spelling.patch
#ofstd_markup_6.patch
#warn_unused_result.patch
-sparc_align.patch
+0001-Fixed-OFoptional-by-introducing-OFalign.patch
+removemd5.patch
Modified: trunk/packages/dcmtk/branches/experimental/debian/rules
===================================================================
--- trunk/packages/dcmtk/branches/experimental/debian/rules 2014-07-04 12:52:58 UTC (rev 17407)
+++ trunk/packages/dcmtk/branches/experimental/debian/rules 2014-07-07 07:10:46 UTC (rev 17408)
@@ -66,8 +66,6 @@
rm debian/tmp/usr/share/man/man1/_*.1
override_dh_installdocs:
- # remove md5:
- find ./debian/tmp/usr/share/doc/dcmtk/html/ -name *.md5 -delete
dh_installdocs -pdcmtk-doc
# do the doxygen / jquery fix:
dh_link -pdcmtk-doc usr/share/javascript/jquery/jquery.js usr/share/doc/dcmtk-doc/html/jquery.js
More information about the debian-med-commit
mailing list