Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Macros
Standard_Macro.hxx File Reference

This file is intended to be the first file included to any Open CASCADE source. It defines platform-specific pre-processor macros necessary for correct compilation of Open CASCADE code. More...

Macros

#define Standard_DEPRECATED_WARNING(theMsg)
 Core helper emitting a compile-time warning about deprecated usage. Honors OCCT_NO_DEPRECATED and provides a single backend used by other deprecation macros.
 
#define Standard_MACRO_DEPRECATED(theMsg)   Standard_DEPRECATED_WARNING(theMsg)
 Macro for marking preprocessor macros as deprecated. When a deprecated macro is used, a compile-time warning will be issued. Unlike Standard_DEPRECATED which marks functions/classes, this is for deprecating macros themselves.
 
#define Standard_HEADER_DEPRECATED(theMsg)   Standard_DEPRECATED_WARNING(theMsg)
 Macro for marking header inclusions as deprecated; place near the top of a deprecated header to emit a compile-time warning when it is included.
 
#define Standard_OVERRIDE    Standard_MACRO_DEPRECATED("Standard_OVERRIDE is deprecated, use override directly") override
 Should be used in declarations of virtual methods overridden in the derived classes, to cause compilation error in the case if that virtual function disappears or changes its signature in the base class.
 
#define Standard_DELETE    Standard_MACRO_DEPRECATED("Standard_DELETE is deprecated, use = delete directly") = delete
 Alias for C++11 keyword "=delete" marking methods to be deleted.
 
#define Standard_FALLTHROUGH
 Should be used in a switch statement immediately before a case label, if code associated with the previous case label may fall through to that next label (i.e. does not end with "break" or "return" etc.). This macro indicates that the fall through is intentional and should not be diagnosed by a compiler that warns on fallthrough.
 
#define Standard_NODISCARD
 This attribute may appear in a function declaration, enumeration declaration or class declaration. It tells the compiler to issue a warning, if a return value marked by that attribute is discarded.
 
#define Standard_UNUSED
 Macro for marking variables / functions as possibly unused so that compiler will not emit redundant "unused" warnings.
 
#define Standard_NOINLINE
 Macro for disallowing function inlining. Expands to "__attribute__((noinline))" on GCC and CLang.
 
#define Standard_THREADLOCAL
 Define Standard_THREADLOCAL modifier as C++11 thread_local keyword where it is available.
 
#define Standard_DEPRECATED(theMsg)
 Can be used in declaration of a method or a class to mark it as deprecated. Use of such method or class will cause compiler warning (if supported by compiler and unless disabled). If macro OCCT_NO_DEPRECATED is defined, Standard_DEPRECATED is defined empty.
 
#define Standard_DEPRECATED_STD(theMsg)   [[deprecated(theMsg)]]
 Marks a declaration as deprecated using the standard C++ [[deprecated]] attribute. Use this instead of Standard_DEPRECATED in contexts where only standard C++ attributes are grammatically valid, such as using-alias declarations: using OldName Standard_DEPRECATED_STD("msg") = NewName; MSVC rejects declspec(deprecated) and GCC/Clang reject __attribute((deprecated)) when placed between the alias name and the = token, so Standard_DEPRECATED cannot be used there. If macro OCCT_NO_DEPRECATED is defined, Standard_DEPRECATED_STD is defined empty.
 
#define Standard_DISABLE_DEPRECATION_WARNINGS
 Disables warnings on use of deprecated features (see Standard_DEPRECATED), from the current point till appearance of Standard_ENABLE_DEPRECATION_WARNINGS macro. This is useful for sections of code kept for backward compatibility and scheduled for removal.
 
#define Standard_ENABLE_DEPRECATION_WARNINGS
 Enables warnings on use of deprecated features previously disabled by Standard_DISABLE_DEPRECATION_WARNINGS.
 
#define Standard_IMPORT   extern
 
#define Standard_IMPORTC   extern "C"
 
#define Standard_HIDDEN
 This macro should be used in declarations of methods or functions to ensure that they are hidden and not exported from the shared library.
 
#define Standard_HASATOMIC
 
#define Standard_ATOMIC(theType)
 Definition of Standard_ATOMIC for C++11 or visual studio that supports it.
 
#define Standard_Noexcept    Standard_MACRO_DEPRECATED("Standard_Noexcept is deprecated, use noexcept directly") noexcept
 Definition of Standard_Noexcept:
 
#define Standard_CPP17_OR_HIGHER   0
 Macro to check if C++ standard version is C++17 or higher.
 

Detailed Description

This file is intended to be the first file included to any Open CASCADE source. It defines platform-specific pre-processor macros necessary for correct compilation of Open CASCADE code.

Macro Definition Documentation

◆ Standard_ATOMIC

#define Standard_ATOMIC ( theType)
Value:
Standard_MACRO_DEPRECATED("Standard_ATOMIC is deprecated, use std::atomic<T> directly") \
std::atomic<theType>
#define Standard_MACRO_DEPRECATED(theMsg)
Macro for marking preprocessor macros as deprecated. When a deprecated macro is used,...
Definition Standard_Macro.hxx:48

Definition of Standard_ATOMIC for C++11 or visual studio that supports it.

Deprecated
Use std::atomic<T> directly instead (guaranteed in C++17) Before usage, include <atomic> header.

◆ Standard_CPP17_OR_HIGHER

#define Standard_CPP17_OR_HIGHER   0

Macro to check if C++ standard version is C++17 or higher.

Expands to 1 if C++17 or higher is available, 0 otherwise. Uses _MSVC_LANG for MSVC (available since VS 2017.3) which correctly reports the language standard regardless of /Zc:__cplusplus flag. For other compilers or as fallback, uses __cplusplus standard macro.

◆ Standard_DELETE

#define Standard_DELETE    Standard_MACRO_DEPRECATED("Standard_DELETE is deprecated, use = delete directly") = delete

Alias for C++11 keyword "=delete" marking methods to be deleted.

Deprecated
Use C++11 "= delete" directly instead (guaranteed in C++17)

◆ Standard_DEPRECATED

#define Standard_DEPRECATED ( theMsg)

Can be used in declaration of a method or a class to mark it as deprecated. Use of such method or class will cause compiler warning (if supported by compiler and unless disabled). If macro OCCT_NO_DEPRECATED is defined, Standard_DEPRECATED is defined empty.

◆ Standard_DEPRECATED_STD

#define Standard_DEPRECATED_STD ( theMsg)    [[deprecated(theMsg)]]

Marks a declaration as deprecated using the standard C++ [[deprecated]] attribute. Use this instead of Standard_DEPRECATED in contexts where only standard C++ attributes are grammatically valid, such as using-alias declarations: using OldName Standard_DEPRECATED_STD("msg") = NewName; MSVC rejects declspec(deprecated) and GCC/Clang reject __attribute((deprecated)) when placed between the alias name and the = token, so Standard_DEPRECATED cannot be used there. If macro OCCT_NO_DEPRECATED is defined, Standard_DEPRECATED_STD is defined empty.

◆ Standard_DEPRECATED_WARNING

#define Standard_DEPRECATED_WARNING ( theMsg)

Core helper emitting a compile-time warning about deprecated usage. Honors OCCT_NO_DEPRECATED and provides a single backend used by other deprecation macros.

◆ Standard_DISABLE_DEPRECATION_WARNINGS

#define Standard_DISABLE_DEPRECATION_WARNINGS

Disables warnings on use of deprecated features (see Standard_DEPRECATED), from the current point till appearance of Standard_ENABLE_DEPRECATION_WARNINGS macro. This is useful for sections of code kept for backward compatibility and scheduled for removal.

◆ Standard_ENABLE_DEPRECATION_WARNINGS

#define Standard_ENABLE_DEPRECATION_WARNINGS

Enables warnings on use of deprecated features previously disabled by Standard_DISABLE_DEPRECATION_WARNINGS.

◆ Standard_FALLTHROUGH

#define Standard_FALLTHROUGH
Value:
Standard_MACRO_DEPRECATED("Standard_FALLTHROUGH is deprecated, use [[fallthrough]]; directly") \
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142

Should be used in a switch statement immediately before a case label, if code associated with the previous case label may fall through to that next label (i.e. does not end with "break" or "return" etc.). This macro indicates that the fall through is intentional and should not be diagnosed by a compiler that warns on fallthrough.

Deprecated
Use C++17 "[[fallthrough]];" directly instead (guaranteed in C++17)

◆ Standard_HASATOMIC

#define Standard_HASATOMIC
Value:
"Standard_HASATOMIC is deprecated, std::atomic is always available in C++17") 1
Deprecated
Always defined in C++17, no need to check for it

◆ Standard_HEADER_DEPRECATED

#define Standard_HEADER_DEPRECATED ( theMsg)    Standard_DEPRECATED_WARNING(theMsg)

Macro for marking header inclusions as deprecated; place near the top of a deprecated header to emit a compile-time warning when it is included.

◆ Standard_HIDDEN

#define Standard_HIDDEN

This macro should be used in declarations of methods or functions to ensure that they are hidden and not exported from the shared library.

Expands to "__attribute__((visibility("hidden")))" on GCC and Clang

◆ Standard_IMPORT

#define Standard_IMPORT   extern

◆ Standard_IMPORTC

#define Standard_IMPORTC   extern "C"

◆ Standard_MACRO_DEPRECATED

#define Standard_MACRO_DEPRECATED ( theMsg)    Standard_DEPRECATED_WARNING(theMsg)

Macro for marking preprocessor macros as deprecated. When a deprecated macro is used, a compile-time warning will be issued. Unlike Standard_DEPRECATED which marks functions/classes, this is for deprecating macros themselves.

◆ Standard_NODISCARD

#define Standard_NODISCARD
Value:
Standard_MACRO_DEPRECATED("Standard_NODISCARD is deprecated, use [[nodiscard]] directly") \

This attribute may appear in a function declaration, enumeration declaration or class declaration. It tells the compiler to issue a warning, if a return value marked by that attribute is discarded.

Deprecated
Use C++17 "[[nodiscard]]" directly instead (guaranteed in C++17)

◆ Standard_Noexcept

#define Standard_Noexcept    Standard_MACRO_DEPRECATED("Standard_Noexcept is deprecated, use noexcept directly") noexcept

Definition of Standard_Noexcept:

Deprecated
Use noexcept keyword directly instead

◆ Standard_NOINLINE

#define Standard_NOINLINE

Macro for disallowing function inlining. Expands to "__attribute__((noinline))" on GCC and CLang.

◆ Standard_OVERRIDE

#define Standard_OVERRIDE    Standard_MACRO_DEPRECATED("Standard_OVERRIDE is deprecated, use override directly") override

Should be used in declarations of virtual methods overridden in the derived classes, to cause compilation error in the case if that virtual function disappears or changes its signature in the base class.

Deprecated
Use C++11 keyword "override" directly instead (guaranteed in C++17)

◆ Standard_THREADLOCAL

#define Standard_THREADLOCAL
Value:
"Standard_THREADLOCAL is deprecated, use thread_local directly") thread_local

Define Standard_THREADLOCAL modifier as C++11 thread_local keyword where it is available.

Deprecated
Use C++11 "thread_local" directly instead (guaranteed in C++17)

◆ Standard_UNUSED

#define Standard_UNUSED

Macro for marking variables / functions as possibly unused so that compiler will not emit redundant "unused" warnings.

Deprecated
Use C++17 "[[maybe_unused]]" directly instead (guaranteed in C++17). Note: [[maybe_unused]] has stricter placement rules than attribute((unused)), so manual migration may be needed for some usages.