// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
// #if is shorter and safer than #ifdef. *_VERSION are zero if not detected, // otherwise 100 * major + minor version. Note that other packages check for // #ifdef COMPILER_MSVC, so we cannot use that same name.
#if JXL_COMPILER_MSVC #define JXL_MAYBE_UNUSED #else // Encountered "attribute list cannot appear here" when using the C++17 // [[maybe_unused]], so only use the old style attribute for now. #define JXL_MAYBE_UNUSED __attribute__((unused)) #endif
// MSAN execution won't hurt if some code it not inlined, but this can greatly // improve compilation time. Unfortunately this macro can not be used just // everywhere - inside header files it leads to "multiple definition" error; // though it would be better not to have JXL_INLINE in header overall. #if JXL_MEMORY_SANITIZER || JXL_ADDRESS_SANITIZER || JXL_THREAD_SANITIZER #define JXL_MAYBE_INLINE JXL_MAYBE_UNUSED #else #define JXL_MAYBE_INLINE JXL_INLINE #endif
#if JXL_COMPILER_MSVC // Unsupported, __assume is not the same. #define JXL_LIKELY(expr) expr #define JXL_UNLIKELY(expr) expr #else #define JXL_LIKELY(expr) __builtin_expect(!!(expr), 1) #define JXL_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #endif
#if JXL_COMPILER_MSVC #include <stdint.h> using ssize_t = intptr_t; #endif
// Returns a void* pointer which the compiler then assumes is N-byte aligned. // Example: float* JXL_RESTRICT aligned = (float*)JXL_ASSUME_ALIGNED(in, 32); // // The assignment semantics are required by GCC/Clang. ICC provides an in-place // __assume_aligned, whereas MSVC's __assume appears unsuitable. #if JXL_COMPILER_CLANG // Early versions of Clang did not support __builtin_assume_aligned. #define JXL_HAS_ASSUME_ALIGNED __has_builtin(__builtin_assume_aligned) #elif JXL_COMPILER_GCC #define JXL_HAS_ASSUME_ALIGNED 1 #else #define JXL_HAS_ASSUME_ALIGNED 0 #endif
// Raises warnings if the function return value is unused. Should appear as the // first part of a function definition/declaration. #if JXL_HAVE_ATTRIBUTE(nodiscard) #define JXL_MUST_USE_RESULT [[nodiscard]] #elif JXL_COMPILER_CLANG && JXL_HAVE_ATTRIBUTE(warn_unused_result) #define JXL_MUST_USE_RESULT __attribute__((warn_unused_result)) #else #define JXL_MUST_USE_RESULT #endif
// Disable certain -fsanitize flags for functions that are expected to include // things like unsigned integer overflow. For example use in the function // declaration JXL_NO_SANITIZE("unsigned-integer-overflow") to silence unsigned // integer overflow ubsan messages. #if JXL_COMPILER_CLANG && JXL_HAVE_ATTRIBUTE(no_sanitize) #define JXL_NO_SANITIZE(X) __attribute__((no_sanitize(X))) #else #define JXL_NO_SANITIZE(X) #endif
// Known / distinguished C++ standards. #define JXL_CXX_17 201703
// In most cases we consider build as "debug". Use `NDEBUG` for release build. #ifdefined(JXL_IS_DEBUG_BUILD) #undef JXL_IS_DEBUG_BUILD #define JXL_IS_DEBUG_BUILD 1 #elifdefined(NDEBUG) #define JXL_IS_DEBUG_BUILD 0 #else #define JXL_IS_DEBUG_BUILD 1 #endif
// Pass -DJXL_DEBUG_ON_ALL_ERROR at compile time to print debug messages on // all error (fatal and non-fatal) status. #ifdefined(JXL_DEBUG_ON_ALL_ERROR) #undef JXL_DEBUG_ON_ALL_ERROR #define JXL_DEBUG_ON_ALL_ERROR 1 #else #define JXL_DEBUG_ON_ALL_ERROR 0 #endif
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.