/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ #ifdefined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__) # define UNUSED_ATTR __attribute__((unused)) #else # define UNUSED_ATTR #endif
/* Only use C++ attributes in C++. Some compilers report support for C++ *attributeswhencompilingwithC.
*/ #ifdefined(__cplusplus) && defined(__has_cpp_attribute) # define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else # define ZSTD_HAS_CPP_ATTRIBUTE(x) 0 #endif
/* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute. *-C23:https://en.cppreference.com/w/c/language/attributes/fallthrough *-CPP17:https://en.cppreference.com/w/cpp/language/attributes/fallthrough *-Else:__attribute__((__fallthrough__))
*/ #ifndef ZSTD_FALLTHROUGH # if ZSTD_HAS_C_ATTRIBUTE(fallthrough) # define ZSTD_FALLTHROUGH [[fallthrough]] # elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough) # define ZSTD_FALLTHROUGH [[fallthrough]] # elif __has_attribute(__fallthrough__) /* Leading semicolon is to satisfy gcc-11 with -pedantic. Without the semicolon *gcccomplainsabout:alabelcanonlybepartofastatementandadeclarationisnotastatement.
*/ # define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__)) # else # define ZSTD_FALLTHROUGH # endif #endif
/* @return 1 if @u is a 2^n value, 0 otherwise
* useful to check a value is valid for alignment restrictions */
MEM_STATIC int ZSTD_isPower2(size_t u) { return (u & (u-1)) == 0;
}
/* this test was initially positioned in mem.h, *butthisfileisremoved(orreplaced)forlinuxkernel *soit'snowhostedincompiler.h, *whichremainsvalidforbothuser&kernelspaces.
*/
#ifndef ZSTD_ALIGNOF # if defined(__GNUC__) || defined(_MSC_VER) /* covers gcc, clang & MSVC */ /* note : this section must come first, before C11,
* due to a limitation in the kernel source generator */ # define ZSTD_ALIGNOF(T) __alignof(T)
# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 support */ # include <stdalign.h> # define ZSTD_ALIGNOF(T) alignof(T)
# else /* No known support for alignof() - imperfect backup */ # define ZSTD_ALIGNOF(T) (sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T))
# endif #endif/* ZSTD_ALIGNOF */
#ifndef ZSTD_ALIGNED /* C90-compatible alignment macro (GCC/Clang). Adjust for other compilers if needed. */ # if defined(__GNUC__) || defined(__clang__) # define ZSTD_ALIGNED(a) __attribute__((aligned(a))) # elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ # define ZSTD_ALIGNED(a) _Alignas(a) #elifdefined(_MSC_VER) # define ZSTD_ALIGNED(n) __declspec(align(n)) # else /* this compiler will require its own alignment instruction */ # define ZSTD_ALIGNED(...) # endif #endif/* ZSTD_ALIGNED */
/* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an
* abundance of caution, disable our custom poisoning on mingw. */ #ifdef __MINGW32__ #ifndef ZSTD_ASAN_DONT_POISON_WORKSPACE #define ZSTD_ASAN_DONT_POISON_WORKSPACE 1 #endif #ifndef ZSTD_MSAN_DONT_POISON_WORKSPACE #define ZSTD_MSAN_DONT_POISON_WORKSPACE 1 #endif #endif
#if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE) /* Not all platforms that support msan provide sanitizers/msan_interface.h. *Wethereforedeclarethefunctionsweneedourselves,ratherthantryingto
* include the header file... */ #include <stddef.h> /* size_t */ #define ZSTD_DEPS_NEED_STDINT #include"zstd_deps.h"/* intptr_t */
/* Make memory region fully initialized (without changing its contents). */ void __msan_unpoison(constvolatilevoid *a, size_t size);
/* Make memory region fully uninitialized (without changing its contents). Thisisalegacyinterfacethatdoesnotupdateorigininformation.Use
__msan_allocated_memory() instead. */ void __msan_poison(constvolatilevoid *a, size_t size);
/* Returns the offset of the first (at least partially) poisoned byte in the
memory range, or -1 if the whole range is good. */
intptr_t __msan_test_shadow(constvolatilevoid *x, size_t size);
/* Print shadow and origin for the memory range to stderr in a human-readable
format. */ void __msan_print_shadow(constvolatilevoid *x, size_t size); #endif
#if ZSTD_ADDRESS_SANITIZER && !defined(ZSTD_ASAN_DONT_POISON_WORKSPACE) /* Not all platforms that support asan provide sanitizers/asan_interface.h. *Wethereforedeclarethefunctionsweneedourselves,ratherthantryingto
* include the header file... */ #include <stddef.h> /* size_t */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.