DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Macros
ofdiag.h File Reference

Defines macros for controlling compiler diagnostic output, i.e. warnings. More...

## Macros
#define | DCMTK_DIAGNOSTIC_PUSH <unspecified>
| A macro for pushing a compiler diagnostic scope. More...
#define | DCMTK_DIAGNOSTIC_POP <unspecified>
| A macro for pop-ing a compiler diagnostic scope, restoring the parent scope. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_SIGN_COMPARE <unspecified>
| A macro to disable warnings about comparing signed with unsigned values. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_OVERFLOW <unspecified>
| A macro to disable warnings about overflowing constant expressions. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS <unspecified>
| A macro to disable warnings about mixing the keywords struct and class. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_PREDEFINED_IDENTIFIER_OUTSIDE_FUNCTION <unspecified>
| A macro to disable warnings about using __func__ etc. outside of a function. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_IMPLICIT_CONVERSION <unspecified>
| A macro to disable warnings about implicit type conversions that may alter the value. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_SHADOW <unspecified>
| A macro to disable warnings about variable/type name shadowing. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_NO_SUITABLE_DEFINITION_FOR_TEMPLATE_INSTANTIATION <unspecified>
| A macro to disable a Visual Studio specific warning about explicit template instantiation. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_PERFORMANCE_WARNING <unspecified>
| A macro to disable the Visual Studio specific "performance warning" about implicit conversion to a boolean value. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_CONST_EXPRESSION_WARNING <unspecified>
| A macro to disable warnings about a conditional expression being constant. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_SELF_ASSIGN_OVERLOADED_WARNING <unspecified>
| A macro to disable warnings about a self-assignment of a variable using an overloaded operator. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_ASSIGNMENT_IN_COND_EXPRESSION_WARNING <unspecified>
| A macro to disable warnings about an assignment within a conditional expression. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_CLASS_MEMACCESS_WARNING <unspecified>
| A macro to disable warnings about raw memory access to class structures. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_PESSIMIZING_MOVE_WARNING <unspecified>
| A macro to disable warnings about pessimizing use of std::move(). More...
#define | DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING <unspecified>
| A macro to disable warnings about code that breaks strict aliasing rules. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING <unspecified>
| A macro to disable Visual Studio warnings about structure padding due to __declspec(align). More...
#define | DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING <unspecified>
| A macro to disable Visual Studio warnings about non-portability of the interaction between a function like setjmp and C++ object destruction. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_UNREACHABLE_CODE_WARNING <unspecified>
| A macro to disable warnings about unreachable code. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_ATTRIBUTE_REDECLARATION <unspecified>
| A macro to disable warnings about ignored attributes due to attribute redeclaration. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_UNREFERENCED_FORMAL_PARAMETER <unspecified>
| A macro to disable warnings about an unreferenced formal parameter. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW <unspecified>
| A macro to disable warnings about an overflow in a string operation. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_RESTRICT <unspecified>
| A macro to disable warnings about a restrict-qualified parameter that is aliased by another argument, or when copies between such objects overlap. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_USE_AFTER_FREE <unspecified>
| A macro to disable warnings about the possible use of an object after deallocation by a call to free(). More...
#define | DCMTK_DIAGNOSTIC_IGNORE_ARRAY_BOUNDS <unspecified>
| A macro to disable warnings about out-of bounds array indices. More...
#define | DCMTK_DIAGNOSTIC_IGNORE_UNSIGNED_UNARY_MINUS <unspecified>
| A macro to disable warnings about the use of the unary minus operator with an unsigned integer type. More...

## Detailed Description

Defines macros for controlling compiler diagnostic output, i.e. warnings.

## Macro Definition Documentation

## ◆ DCMTK_DIAGNOSTIC_IGNORE_ARRAY_BOUNDS

#define DCMTK_DIAGNOSTIC_IGNORE_ARRAY_BOUNDS <unspecified>

A macro to disable warnings about out-of bounds array indices.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_ASSIGNMENT_IN_COND_EXPRESSION_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_ASSIGNMENT_IN_COND_EXPRESSION_WARNING <unspecified>

A macro to disable warnings about an assignment within a conditional expression.

Note
  The macro may only be used in conjunction with #include!

Remarks
  The warning indicates that an assignment takes place within a conditional expression, which might indicate that "=" was used erroneously instead of "==".

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_ATTRIBUTE_REDECLARATION

#define DCMTK_DIAGNOSTIC_IGNORE_ATTRIBUTE_REDECLARATION <unspecified>

A macro to disable warnings about ignored attributes due to attribute redeclaration.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_CLASS_MEMACCESS_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_CLASS_MEMACCESS_WARNING <unspecified>

A macro to disable warnings about raw memory access to class structures.

Note
  The macro may only be used in conjunction with #include!

Remarks
  The warning indicates that the destination of a call to a raw memory function such as memset or memcpy is an object of class type, and when writing into such an object might bypass the class non-trivial or deleted constructor or copy assignment, violate const-correctness or encapsulation, or corrupt virtual table pointers.

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_CONST_EXPRESSION_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_CONST_EXPRESSION_WARNING <unspecified>

A macro to disable warnings about a conditional expression being constant.

Note
  The macro may only be used in conjunction with #include!

Remarks
  The warning indicates that a conditional expression will always yield the same result. In C++17, the "if constexpr" statement should be used in this case, but DCMTK does not (yet) expect a fully C++17 compliant compiler.

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_IMPLICIT_CONVERSION

#define DCMTK_DIAGNOSTIC_IGNORE_IMPLICIT_CONVERSION <unspecified>

A macro to disable warnings about implicit type conversions that may alter the value.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS

#define DCMTK_DIAGNOSTIC_IGNORE_MISMATCHED_TAGS <unspecified>

A macro to disable warnings about mixing the keywords struct and class.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_NO_SUITABLE_DEFINITION_FOR_TEMPLATE_INSTANTIATION

#define DCMTK_DIAGNOSTIC_IGNORE_NO_SUITABLE_DEFINITION_FOR_TEMPLATE_INSTANTIATION <unspecified>

A macro to disable a Visual Studio specific warning about explicit template instantiation.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_OVERFLOW

#define DCMTK_DIAGNOSTIC_IGNORE_OVERFLOW <unspecified>

A macro to disable warnings about overflowing constant expressions.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_PESSIMIZING_MOVE_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_PESSIMIZING_MOVE_WARNING <unspecified>

A macro to disable warnings about pessimizing use of std::move().

Note
  The macro may only be used in conjunction with #include!

Remarks
  The warning indicates that moving a local object in a return statement prevents copy elision and thus causes less efficient code to be generated.

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_PREDEFINED_IDENTIFIER_OUTSIDE_FUNCTION

#define DCMTK_DIAGNOSTIC_IGNORE_PREDEFINED_IDENTIFIER_OUTSIDE_FUNCTION <unspecified>

A macro to disable warnings about using __func__ etc. outside of a function.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_RESTRICT

#define DCMTK_DIAGNOSTIC_IGNORE_RESTRICT <unspecified>

A macro to disable warnings about a restrict-qualified parameter that is aliased by another argument, or when copies between such objects overlap.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_SELF_ASSIGN_OVERLOADED_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_SELF_ASSIGN_OVERLOADED_WARNING <unspecified>

A macro to disable warnings about a self-assignment of a variable using an overloaded operator.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_SHADOW

#define DCMTK_DIAGNOSTIC_IGNORE_SHADOW <unspecified>

A macro to disable warnings about variable/type name shadowing.

Note
  The macro may only be used in conjunction with #include!

Remarks
  This warning is typically helpful to prevent unintended behavior, however, small structs often have members with matching names as constructor arguments (for consistent use/assignment). It makes sense to suppress this warning in that case.

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_SIGN_COMPARE

#define DCMTK_DIAGNOSTIC_IGNORE_SIGN_COMPARE <unspecified>

A macro to disable warnings about comparing signed with unsigned values.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING <unspecified>

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 also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW

#define DCMTK_DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW <unspecified>

A macro to disable warnings about an overflow in a string operation.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_UNREACHABLE_CODE_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_UNREACHABLE_CODE_WARNING <unspecified>

A macro to disable warnings about unreachable code.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_UNREFERENCED_FORMAL_PARAMETER

#define DCMTK_DIAGNOSTIC_IGNORE_UNREFERENCED_FORMAL_PARAMETER <unspecified>

A macro to disable warnings about an unreferenced formal parameter.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_UNSIGNED_UNARY_MINUS

#define DCMTK_DIAGNOSTIC_IGNORE_UNSIGNED_UNARY_MINUS <unspecified>

A macro to disable warnings about the use of the unary minus operator with an unsigned integer type.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_USE_AFTER_FREE

#define DCMTK_DIAGNOSTIC_IGNORE_USE_AFTER_FREE <unspecified>

A macro to disable warnings about the possible use of an object after deallocation by a call to free().

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_DECLSPEC_PADDING_WARNING <unspecified>

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 also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_OBJECT_DESTRUCTION_WARNING <unspecified>

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 also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_PERFORMANCE_WARNING

#define DCMTK_DIAGNOSTIC_IGNORE_VISUAL_STUDIO_PERFORMANCE_WARNING <unspecified>

A macro to disable the Visual Studio specific "performance warning" about implicit conversion to a boolean value.

Note
  The macro may only be used in conjunction with #include!

Remarks
  The warning was meant to indicate that a non boolean value should probably be stored as a boolean value in the first place, instead of using an integer (i.e. when C programmers do C++). However, that is hardly ever the case and it is mostly and annoyingly emitted in perfectly fine code that checks if a value is not equal to zero etc., therefore, suppressing it is usually appropriate.

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_POP

#define DCMTK_DIAGNOSTIC_POP <unspecified>

A macro for pop-ing a compiler diagnostic scope, restoring the parent scope.

Note
  The macro may only be used in conjunction with #include!

See also
  DCMTK_DIAGNOSTIC_PUSH for an example.

## ◆ DCMTK_DIAGNOSTIC_PUSH

#define DCMTK_DIAGNOSTIC_PUSH <unspecified>

A macro for pushing a compiler diagnostic scope.

Note
  The macro may only be used in conjunction with #include!

If the compiler supports diagnostic scopes, using this macro will create a new one inside which warning messages might be disabled selectively. The macro will have no effect if the compiler does not support diagnostic scopes.

Remarks
  Currently supported compilers are GCC (version 4.6 and later, including derivates like MinGW), Clang and Visual Studio.

### Example

int i = 3;
unsigned ui = 8;
// will potentially emit a warning, although perfectly safe
if( i < ui )
doStuff();
// create a new diagnostic scope
#include DCMTK_DIAGNOSTIC_PUSH
// disable the sign mismatch warning
#include DCMTK_DIAGNOSTIC_IGNORE_SIGN_COMPARE
// the warning is omitted!
if( i < ui )
doStuff();
// restore the parent diagnostic scope potentially enabling
// the sign mismatch warning again
#include DCMTK_DIAGNOSTIC_POP

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1