From 9c69ded9c3b1945c01f6836222d0b73be17baca2 Mon Sep 17 00:00:00 2001 From: Marco Eichelberg Date: Wed, 9 Jun 2021 18:06:37 +0200 Subject: [PATCH] Fixed minor warnings. --- CMake/dcmtkPrepare.cmake | 2 ++ dcmdata/libsrc/vrscan.cc | 8 +++++- dcmimage/libsrc/dipipng.cc | 7 ++++- dcmjpeg/libsrc/dipijpeg.cc | 10 +++++++ dcmjpeg/libsrc/djdijg12.cc | 10 +++++++ dcmjpeg/libsrc/djdijg16.cc | 10 +++++++ dcmjpeg/libsrc/djdijg8.cc | 11 ++++++++ dcmjpeg/libsrc/djeijg12.cc | 11 ++++++++ dcmjpeg/libsrc/djeijg16.cc | 12 ++++++++ dcmjpeg/libsrc/djeijg8.cc | 11 ++++++++ dcmnet/libsrc/dccfrsmp.cc | 5 ++-- oflog/include/dcmtk/oflog/helpers/strhelp.h | 5 +--- ofstd/include/dcmtk/ofstd/diag/pessmove.def | 2 +- ofstd/include/dcmtk/ofstd/diag/stralias.def | 8 ++++++ ofstd/include/dcmtk/ofstd/diag/vsdeclpd.def | 4 +++ ofstd/include/dcmtk/ofstd/diag/vsobjdes.def | 4 +++ ofstd/include/dcmtk/ofstd/ofdiag.h | 31 +++++++++++++++++++++ ofstd/libsrc/ofstd.cc | 3 ++ 18 files changed, 145 insertions(+), 9 deletions(-) create mode 100644 ofstd/include/dcmtk/ofstd/diag/stralias.def create mode 100644 ofstd/include/dcmtk/ofstd/diag/vsdeclpd.def create mode 100644 ofstd/include/dcmtk/ofstd/diag/vsobjdes.def diff --git a/CMake/dcmtkPrepare.cmake b/CMake/dcmtkPrepare.cmake index 2b99835d76..2515b5d054 100644 --- a/CMake/dcmtkPrepare.cmake +++ b/CMake/dcmtkPrepare.cmake @@ -404,6 +404,8 @@ if(WIN32) # special handling for Windows systems -D_CRT_VCCLRIT_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE ) + # suppress linker warning LNK4099 about missing .pdb files when compiling in debug mode + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099") endif() # Enable various warnings endif() diff --git a/dcmdata/libsrc/vrscan.cc b/dcmdata/libsrc/vrscan.cc index d246391c76..63a26054ea 100644 --- a/dcmdata/libsrc/vrscan.cc +++ b/dcmdata/libsrc/vrscan.cc @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2010-2018, OFFIS e.V. + * Copyright (C) 2010-2021, OFFIS e.V. * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation were developed by @@ -26,12 +26,16 @@ #include "dcmtk/ofstd/ofbmanip.h" #include "dcmtk/ofstd/ofstd.h" /* For OFString::strerror() */ #include "dcmtk/dcmdata/dctypes.h" /* For DCMDATA_WARN() */ +#include "dcmtk/ofstd/ofdiag.h" BEGIN_EXTERN_C #include "vrscani.h" #include "vrscanl.h" END_EXTERN_C +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + int vrscan::scan(const OFString& vr, const char* const value, const size_t size) { yyscan_t scanner; @@ -74,6 +78,8 @@ int vrscan::scan(const OFString& vr, const char* const value, const size_t size) return result; } +#include DCMTK_DIAGNOSTIC_POP + int vrscan::scan(const OFString& vr, const OFString& value) { return scan(vr, value.data(), value.size()); diff --git a/dcmimage/libsrc/dipipng.cc b/dcmimage/libsrc/dipipng.cc index 162045d6b8..51140d0357 100644 --- a/dcmimage/libsrc/dipipng.cc +++ b/dcmimage/libsrc/dipipng.cc @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2003-2019, OFFIS e.V. + * Copyright (C) 2003-2021, OFFIS e.V. * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation were developed by @@ -28,6 +28,7 @@ #include "dcmtk/dcmimgle/diimage.h" #include "dcmtk/dcmimage/dipipng.h" #include "dcmtk/dcmdata/dcuid.h" /* for dcmtk version */ +#include "dcmtk/ofstd/ofdiag.h" BEGIN_EXTERN_C #ifdef HAVE_LIBPNG_PNG_H @@ -51,6 +52,8 @@ DiPNGPlugin::~DiPNGPlugin() { } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING int DiPNGPlugin::write( DiImage *image, @@ -191,6 +194,8 @@ int DiPNGPlugin::write( return result; } +#include DCMTK_DIAGNOSTIC_POP + void DiPNGPlugin::setInterlaceType(DiPNGInterlace itype) { diff --git a/dcmjpeg/libsrc/dipijpeg.cc b/dcmjpeg/libsrc/dipijpeg.cc index 2a316d85de..1fee5dd24a 100644 --- a/dcmjpeg/libsrc/dipijpeg.cc +++ b/dcmjpeg/libsrc/dipijpeg.cc @@ -25,6 +25,7 @@ #include "dcmtk/dcmimgle/diimage.h" #include "dcmtk/dcmjpeg/dipijpeg.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include BEGIN_EXTERN_C @@ -44,6 +45,9 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DIEIJG8ErrorStruct { @@ -55,6 +59,8 @@ struct DIEIJG8ErrorStruct const DiJPEGPlugin *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // callback forward declarations void DIEIJG8ErrorExit(j_common_ptr); void DIEIJG8OutputMessage(j_common_ptr cinfo); @@ -133,6 +139,8 @@ void DiJPEGPlugin::outputMessage(void *arg) const } } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING int DiJPEGPlugin::write(DiImage *image, FILE *stream, @@ -235,6 +243,8 @@ int DiJPEGPlugin::write(DiImage *image, return result; } +#include DCMTK_DIAGNOSTIC_POP + OFString DiJPEGPlugin::getLibraryVersionString() { diff --git a/dcmjpeg/libsrc/djdijg12.cc b/dcmjpeg/libsrc/djdijg12.cc index 105adb40bf..36e45ee5a3 100644 --- a/dcmjpeg/libsrc/djdijg12.cc +++ b/dcmjpeg/libsrc/djdijg12.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -51,6 +52,9 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DJDIJG12ErrorStruct { @@ -64,6 +68,8 @@ struct DJDIJG12ErrorStruct DJDecompressIJG12Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // private source manager struct struct DJDIJG12SourceManagerStruct { @@ -197,6 +203,8 @@ DJDecompressIJG12Bit::~DJDecompressIJG12Bit() cleanup(); } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING OFCondition DJDecompressIJG12Bit::init() { @@ -444,6 +452,8 @@ OFCondition DJDecompressIJG12Bit::decode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJDecompressIJG12Bit::emitMessage(int msg_level) const { // This is how we map the message levels: diff --git a/dcmjpeg/libsrc/djdijg16.cc b/dcmjpeg/libsrc/djdijg16.cc index f0365d7eaa..561297339f 100644 --- a/dcmjpeg/libsrc/djdijg16.cc +++ b/dcmjpeg/libsrc/djdijg16.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -51,6 +52,9 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DJDIJG16ErrorStruct { @@ -64,6 +68,8 @@ struct DJDIJG16ErrorStruct DJDecompressIJG16Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // private source manager struct struct DJDIJG16SourceManagerStruct { @@ -197,6 +203,8 @@ DJDecompressIJG16Bit::~DJDecompressIJG16Bit() cleanup(); } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING OFCondition DJDecompressIJG16Bit::init() { @@ -447,6 +455,8 @@ OFCondition DJDecompressIJG16Bit::decode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJDecompressIJG16Bit::emitMessage(int msg_level) const { // This is how we map the message levels: diff --git a/dcmjpeg/libsrc/djdijg8.cc b/dcmjpeg/libsrc/djdijg8.cc index 9c1f065b0c..79730b739b 100644 --- a/dcmjpeg/libsrc/djdijg8.cc +++ b/dcmjpeg/libsrc/djdijg8.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -51,6 +52,10 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + // private error handler struct struct DJDIJG8ErrorStruct { @@ -64,6 +69,8 @@ struct DJDIJG8ErrorStruct DJDecompressIJG8Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // private source manager struct struct DJDIJG8SourceManagerStruct { @@ -197,6 +204,8 @@ DJDecompressIJG8Bit::~DJDecompressIJG8Bit() cleanup(); } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING OFCondition DJDecompressIJG8Bit::init() { @@ -444,6 +453,8 @@ OFCondition DJDecompressIJG8Bit::decode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJDecompressIJG8Bit::emitMessage(int msg_level) const { // This is how we map the message levels: diff --git a/dcmjpeg/libsrc/djeijg12.cc b/dcmjpeg/libsrc/djeijg12.cc index 95fa707790..9ff7292d87 100644 --- a/dcmjpeg/libsrc/djeijg12.cc +++ b/dcmjpeg/libsrc/djeijg12.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -55,6 +56,9 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DJEIJG12ErrorStruct { @@ -68,6 +72,8 @@ struct DJEIJG12ErrorStruct DJCompressIJG12Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // callback forward declarations void DJEIJG12ErrorExit(j_common_ptr); void DJEIJG12EmitMessage(j_common_ptr cinfo, int msg_level); @@ -331,6 +337,9 @@ OFCondition DJCompressIJG12Bit::encode( return EC_IllegalCall; } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + OFCondition DJCompressIJG12Bit::encode( Uint16 columns, Uint16 rows, @@ -483,6 +492,8 @@ OFCondition DJCompressIJG12Bit::encode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJCompressIJG12Bit::initDestination(jpeg_compress_struct *cinfo) { cleanup(); // erase old list of compressed blocks, if any diff --git a/dcmjpeg/libsrc/djeijg16.cc b/dcmjpeg/libsrc/djeijg16.cc index abde50a618..68ea601ee2 100644 --- a/dcmjpeg/libsrc/djeijg16.cc +++ b/dcmjpeg/libsrc/djeijg16.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -55,6 +56,10 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DJEIJG16ErrorStruct { @@ -68,6 +73,8 @@ struct DJEIJG16ErrorStruct DJCompressIJG16Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // callback forward declarations void DJEIJG16ErrorExit(j_common_ptr); void DJEIJG16EmitMessage(j_common_ptr cinfo, int msg_level); @@ -176,6 +183,9 @@ OFCondition DJCompressIJG16Bit::encode( return EC_IllegalCall; } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + OFCondition DJCompressIJG16Bit::encode( Uint16 columns, Uint16 rows, @@ -319,6 +329,8 @@ OFCondition DJCompressIJG16Bit::encode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJCompressIJG16Bit::initDestination(jpeg_compress_struct *cinfo) { cleanup(); // erase old list of compressed blocks, if any diff --git a/dcmjpeg/libsrc/djeijg8.cc b/dcmjpeg/libsrc/djeijg8.cc index 4e9d57ec9e..c5f40bf95f 100644 --- a/dcmjpeg/libsrc/djeijg8.cc +++ b/dcmjpeg/libsrc/djeijg8.cc @@ -24,6 +24,7 @@ #include "dcmtk/dcmjpeg/djcparam.h" #include "dcmtk/dcmdata/dcerror.h" #include "dcmtk/ofstd/ofstdinc.h" +#include "dcmtk/ofstd/ofdiag.h" #include // These two macros are re-defined in the IJG header files. @@ -55,6 +56,9 @@ BEGIN_EXTERN_C using STD_NAMESPACE longjmp; using STD_NAMESPACE jmp_buf; +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + // private error handler struct struct DJEIJG8ErrorStruct { @@ -68,6 +72,8 @@ struct DJEIJG8ErrorStruct DJCompressIJG8Bit *instance; }; +#include DCMTK_DIAGNOSTIC_POP + // callback forward declarations void DJEIJG8ErrorExit(j_common_ptr); void DJEIJG8EmitMessage(j_common_ptr cinfo, int msg_level); @@ -332,6 +338,9 @@ OFCondition DJCompressIJG8Bit::encode( return EC_IllegalCall; } +#include DCMTK_DIAGNOSTIC_PUSH +#include DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + OFCondition DJCompressIJG8Bit::encode( Uint16 columns, Uint16 rows, @@ -485,6 +494,8 @@ OFCondition DJCompressIJG8Bit::encode( return EC_Normal; } +#include DCMTK_DIAGNOSTIC_POP + void DJCompressIJG8Bit::initDestination(jpeg_compress_struct *cinfo) { cleanup(); // erase old list of compressed blocks, if any diff --git a/dcmnet/libsrc/dccfrsmp.cc b/dcmnet/libsrc/dccfrsmp.cc index f4730ea936..2a5cca4b84 100644 --- a/dcmnet/libsrc/dccfrsmp.cc +++ b/dcmnet/libsrc/dccfrsmp.cc @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2003-2017, OFFIS e.V. + * Copyright (C) 2003-2021, OFFIS e.V. * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation were developed by @@ -123,10 +123,11 @@ OFCondition DcmRoleSelectionMap::add( DcmRoleSelectionList * const *value = NULL; OFString skey(key); OFMap::iterator it = map_.find(skey); + DcmRoleSelectionList *newentry = NULL; if (it == map_.end()) { - DcmRoleSelectionList *newentry = new DcmRoleSelectionList(); + newentry = new DcmRoleSelectionList(); map_.insert(OFPair(skey, newentry)); value = &newentry; } diff --git a/oflog/include/dcmtk/oflog/helpers/strhelp.h b/oflog/include/dcmtk/oflog/helpers/strhelp.h index 8cb5760aa2..7f51737727 100644 --- a/oflog/include/dcmtk/oflog/helpers/strhelp.h +++ b/oflog/include/dcmtk/oflog/helpers/strhelp.h @@ -103,9 +103,6 @@ namespace log4cplus { // integer overflow of an signed type is undefined behavior :( // This code is based upon http://www.fefe.de/intof.html - // True if intType is unsigned - const OFBool isUnsigned = (OFstatic_cast(intType, -1) < 0) ? OFFalse : OFTrue; - // If intType is a signed type, halfMaxSigned is intType_MAX / 2 const intType halfMaxSigned = OFstatic_cast(intType, 1) << (sizeof(intType) * 8 - 2); @@ -116,7 +113,7 @@ namespace log4cplus { const intType minSigned = OFstatic_cast(intType, -1) - maxSigned; // This is the minimum value that intType can represent; - const intType minVal = isUnsigned ? 0 : minSigned; + const intType minVal = (OFstatic_cast(intType, -1) < 0) ? minSigned : 0; //if (value == (STD_NAMESPACE numeric_limits::min) ()) if (value == minVal) diff --git a/ofstd/include/dcmtk/ofstd/diag/pessmove.def b/ofstd/include/dcmtk/ofstd/diag/pessmove.def index 699ed462f4..36a1a3834b 100644 --- a/ofstd/include/dcmtk/ofstd/diag/pessmove.def +++ b/ofstd/include/dcmtk/ofstd/diag/pessmove.def @@ -2,7 +2,7 @@ #pragma clang diagnostic ignored "-Wpessimizing-move" /* The next line is equivalent to #elif DCMTK_DIAGNOSTIC_MIN_GCC_VERSION(9,0,0) */ #elif ( defined(__GNUC__) && (__GNUC__ >= 9 ) ) -#pragma GCC diagnostic ignored "-Wno-pessimizing-move" +#pragma GCC diagnostic ignored "-Wpessimizing-move" #elif defined(_MSC_VER) /* no such warning in MSVC */ #endif diff --git a/ofstd/include/dcmtk/ofstd/diag/stralias.def b/ofstd/include/dcmtk/ofstd/diag/stralias.def new file mode 100644 index 0000000000..ce717d441f --- /dev/null +++ b/ofstd/include/dcmtk/ofstd/diag/stralias.def @@ -0,0 +1,8 @@ +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wstrict-aliasing" +/* The next line is equivalent to #elif DCMTK_DIAGNOSTIC_MIN_GCC_VERSION(4,6,0) */ +#elif ( defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) ) ) +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#elif defined(_MSC_VER) +/* no such warning on MSVC */ +#endif diff --git a/ofstd/include/dcmtk/ofstd/diag/vsdeclpd.def b/ofstd/include/dcmtk/ofstd/diag/vsdeclpd.def new file mode 100644 index 0000000000..4e5bbfbf27 --- /dev/null +++ b/ofstd/include/dcmtk/ofstd/diag/vsdeclpd.def @@ -0,0 +1,4 @@ +// Clang and GCC don't seem to have such a warning +#ifdef _MSC_VER +#pragma warning(disable: 4324) +#endif diff --git a/ofstd/include/dcmtk/ofstd/diag/vsobjdes.def b/ofstd/include/dcmtk/ofstd/diag/vsobjdes.def new file mode 100644 index 0000000000..3291e538b3 --- /dev/null +++ b/ofstd/include/dcmtk/ofstd/diag/vsobjdes.def @@ -0,0 +1,4 @@ +// Clang and GCC don't seem to have such a warning +#ifdef _MSC_VER +#pragma warning(disable: 4611) +#endif diff --git a/ofstd/include/dcmtk/ofstd/ofdiag.h b/ofstd/include/dcmtk/ofstd/ofdiag.h index 1276938b90..489cd35772 100644 --- a/ofstd/include/dcmtk/ofstd/ofdiag.h +++ b/ofstd/include/dcmtk/ofstd/ofdiag.h @@ -167,6 +167,34 @@ */ #define DCMTK_DIAGNOSTIC_IGNORE_PESSIMIZING_MOVE_WARNING +/*! @brief A macro to disable warnings about code that breaks strict + * aliasing rules + * @note The macro may only be used in conjunction with #include! + * @remarks The warning indicates that certain code constructs will + * break strict aliasing rules, such as dereferencing a type-punned pointer. + * @see DCMTK_DIAGNOSTIC_PUSH for an example. + */ +#define DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING + +/*! @brief A macro to disable Visual Studio warnings about structure + * padding due to __declspec(align). + * @note The macro may only be used in conjunction with #include! + * @remarks The warning indicates that a certain structure has been + * padded at the end because of a __declspec(align) declaration. + * @see DCMTK_DIAGNOSTIC_PUSH for an example. + */ +#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING + +/*! @brief A macro to disable Visual Studio warnings about non-portability + * of the interaction between a function like setjmp and C++ object destruction + * @note The macro may only be used in conjunction with #include! + * @remarks The warning indicates that on some platforms, functions + * that include 'catch' may not support C++ object semantics of + * destruction when out of scope. + * @see DCMTK_DIAGNOSTIC_PUSH for an example. + */ +#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING + #else // DOXYGEN #define DCMTK_DIAGNOSTIC_PUSH "dcmtk/ofstd/diag/push.def" @@ -184,6 +212,9 @@ #define DCMTK_DIAGNOSTIC_IGNORE_ASSIGNMENT_IN_COND_EXPRESSION_WARNING "dcmtk/ofstd/diag/asincond.def" #define DCMTK_DIAGNOSTIC_IGNORE_CLASS_MEMACCESS_WARNING "dcmtk/ofstd/diag/memacces.def" #define DCMTK_DIAGNOSTIC_IGNORE_PESSIMIZING_MOVE_WARNING "dcmtk/ofstd/diag/pessmove.def" +#define DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING "dcmtk/ofstd/diag/stralias.def" +#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING "dcmtk/ofstd/diag/vsdeclpd.def" +#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING "dcmtk/ofstd/diag/vsobjdes.def" // readable shorthands for compiler version checks #define DCMTK_DIAGNOSTIC_MIN_GCC_VERSION(MAJOR, MINOR, PATCH)\ diff --git a/ofstd/libsrc/ofstd.cc b/ofstd/libsrc/ofstd.cc index 60840261fe..b848f62bee 100644 --- a/ofstd/libsrc/ofstd.cc +++ b/ofstd/libsrc/ofstd.cc @@ -109,6 +109,7 @@ END_EXTERN_C #include "dcmtk/ofstd/ofmath.h" #include "dcmtk/ofstd/ofsockad.h" #include "dcmtk/ofstd/ofvector.h" +#include "dcmtk/ofstd/ofdiag.h" #include #include /* for memset() */ @@ -3230,6 +3231,8 @@ OFerror_code OFStandard::getLastNetworkErrorCode() #endif } +#include DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING + // black magic: // The C++ standard says that std::in_place should not be called as a function, // but the linker says we still need a function body. Normally, we would mark