Skip to content
Myr

Improve stb_sprintf asan workaround.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Adds support for more versions of clang and gcc.

authored by Kevin Schmidt · committed by Kevin Schmidt · parent c711058 · Browse files · 1 file+20 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−8 removed

  • other:+20 added−8 removed

1 file+20 added−8 removed

modified:stb_sprintf.h+20 added-8 removed
128 unmodified lines
129"%s%s%s" for 64 char strings (7.1x/7.3x faster)130"...512 char string..." ( 35.0x/32.5x faster!)131*/132133#if defined(__has_feature)134 #if __has_feature(address_sanitizer)135 #define STBI__ASAN __attribute__((no_sanitize("address")))133#if defined(__clang__)134 #if defined(__has_feature) && defined(__has_attribute)135 #if __has_feature(address_sanitizer)136 #if __has_attribute(__no_sanitize__)137 #define STBSP__ASAN __attribute__((__no_sanitize__("address")))138 #elif __has_attribute(__no_sanitize_address__)139 #define STBSP__ASAN __attribute__((__no_sanitize_address__))140 #elif __has_attribute(__no_address_safety_analysis__)141 #define STBSP__ASAN __attribute__((__no_address_safety_analysis__))142 #endif143 #endif144 #endif145#elif __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)146 #if __SANITIZE_ADDRESS__147 #define STBSP__ASAN __attribute__((__no_sanitize_address__))148 #endif149#endif138#ifndef STBI__ASAN139#define STBI__ASAN150#ifndef STBSP__ASAN151#define STBSP__ASAN152#endif153154#ifdef STB_SPRINTF_STATIC155#define STBSP__PUBLICDEC static144#define STBSP__PUBLICDEF static STBI__ASAN156#define STBSP__PUBLICDEF static STBSP__ASAN157#else158#ifdef __cplusplus159#define STBSP__PUBLICDEC extern "C"148#define STBSP__PUBLICDEF extern "C" STBI__ASAN160#define STBSP__PUBLICDEF extern "C" STBSP__ASAN161#else162#define STBSP__PUBLICDEC extern151#define STBSP__PUBLICDEF STBI__ASAN163#define STBSP__PUBLICDEF STBSP__ASAN164#endif165#endif166167#include <stdarg.h> // for va_list()
1047 unmodified lines