1 /* 2 * Copyright 2019 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SKSL_DEFINES 9 #define SKSL_DEFINES 10 11 #include <cstdint> 12 13 #ifdef SKSL_STANDALONE 14 #if defined(_WIN32) || defined(__SYMBIAN32__) 15 #define SKSL_BUILD_FOR_WIN 16 #endif 17 #else 18 #ifdef SK_BUILD_FOR_WIN 19 #define SKSL_BUILD_FOR_WIN 20 #endif // SK_BUILD_FOR_WIN 21 #endif // SKSL_STANDALONE 22 23 #ifdef SKSL_STANDALONE 24 #define SkASSERT(x) do { if (!(x)) abort(); } while (false) 25 #define SkAssertResult(x) do { if (!(x)) abort(); } while (false) 26 #define SkDEBUGCODE(...) __VA_ARGS__ 27 #define SK_API 28 #else 29 #include "include/core/SkTypes.h" 30 #endif 31 32 #if defined(__clang__) || defined(__GNUC__) 33 #define SKSL_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B)))) 34 #define SKSL_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 35 #else 36 #define SKSL_PRINTF_LIKE(A, B) 37 #define SKSL_WARN_UNUSED_RESULT 38 #endif 39 40 #define ABORT(...) (printf(__VA_ARGS__), sksl_abort()) 41 42 #if _MSC_VER 43 #define NORETURN __declspec(noreturn) 44 #else 45 #define NORETURN __attribute__((__noreturn__)) 46 #endif 47 48 using SKSL_INT = int32_t; 49 using SKSL_FLOAT = float; 50 51 #endif 52