Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/sksl/SkSLUtil.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/SkSLToken.h ('k') | src/sksl/SkSLUtil.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 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_UTIL
9 #define SKSL_UTIL
10
11 #include <string>
12 #include <sstream>
13 #include "stdlib.h"
14 #include "assert.h"
15 #include "SkTypes.h"
16
17 namespace SkSL {
18
19 // our own definitions of certain std:: functions, because they are not always p resent on Android
20
21 template <typename T> std::string to_string(T value) {
22 #ifdef SK_BUILD_FOR_ANDROID
23 std::stringstream buffer;
24 buffer << value;
25 return buffer.str();
26 #else
27 return std::to_string(value);
28 #endif
29 }
30
31 #if _MSC_VER
32 #define NORETURN __declspec(noreturn)
33 #else
34 #define NORETURN __attribute__((__noreturn__))
35 #endif
36 int stoi(std::string s);
37
38 double stod(std::string s);
39
40 long stol(std::string s);
41
42 NORETURN void sksl_abort();
43
44 } // namespace
45
46 #ifdef DEBUG
47 #define ASSERT(x) assert(x)
48 #define ASSERT_RESULT(x) ASSERT(x);
49 #else
50 #define ASSERT(x)
51 #define ASSERT_RESULT(x) x
52 #endif
53
54 #ifdef SKIA
55 #define ABORT(...) { SkDebugf(__VA_ARGS__); sksl_abort(); }
56 #else
57 #define ABORT(...) { sksl_abort(); }
58 #endif
59
60 #endif
OLDNEW
« no previous file with comments | « src/sksl/SkSLToken.h ('k') | src/sksl/SkSLUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698