diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-01-04 20:01:42 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-04 20:01:42 +0800 |
| commit | 57e9786d69f7d7846a289f5d2ce8a34c5f177e93 (patch) | |
| tree | ba76411d2925c72ce682d437c2af7069df83264a /source/core/slang-common.h | |
| parent | 6dbdb74dbdc20783a0429229c21604a3d08d28f8 (diff) | |
Add format checking attributes on printf-like functions (#2570)
* Add format checking attributes on printf-like functions
* Don't use printf format attributes on msvc
Where they are not supported
Diffstat (limited to 'source/core/slang-common.h')
| -rw-r--r-- | source/core/slang-common.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/core/slang-common.h b/source/core/slang-common.h index 7fddb067e..cd1490a20 100644 --- a/source/core/slang-common.h +++ b/source/core/slang-common.h @@ -120,6 +120,12 @@ template<typename T> void slang_use_obj(T&) {} #endif #endif +#if defined(_MSC_VER) +# define SLANG_ATTR_PRINTF(string_index, varargs_index) +#else +# define SLANG_ATTR_PRINTF(string_index, varargs_index) __attribute__((format(printf, string_index, varargs_index))) +#endif + #ifndef SLANG_RT_API #define SLANG_RT_API #endif |
