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

Side by Side Diff: runtime/platform/globals.h

Issue 9241008: Remove dependency from platform/globals.h to platform/assert.h (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_GLOBALS_H_ 5 #ifndef PLATFORM_GLOBALS_H_
6 #define PLATFORM_GLOBALS_H_ 6 #define PLATFORM_GLOBALS_H_
7 7
8 // __STDC_FORMAT_MACROS has to be defined to enable platform independent printf. 8 // __STDC_FORMAT_MACROS has to be defined to enable platform independent printf.
9 #ifndef __STDC_FORMAT_MACROS 9 #ifndef __STDC_FORMAT_MACROS
10 #define __STDC_FORMAT_MACROS 10 #define __STDC_FORMAT_MACROS
(...skipping 22 matching lines...) Expand all
33 #include <float.h> 33 #include <float.h>
34 #include <limits.h> 34 #include <limits.h>
35 #include <math.h> 35 #include <math.h>
36 #include <openssl/bn.h> 36 #include <openssl/bn.h>
37 #include <stdarg.h> 37 #include <stdarg.h>
38 #include <stddef.h> 38 #include <stddef.h>
39 #include <stdio.h> 39 #include <stdio.h>
40 #include <stdlib.h> 40 #include <stdlib.h>
41 #include <string.h> 41 #include <string.h>
42 #include <sys/types.h> 42 #include <sys/types.h>
43 #include <cstdlib>
44 #include <sstream>
43 45
44 #if defined(_WIN32) 46 #if defined(_WIN32)
45 #include "platform/c99_support_win.h" 47 #include "platform/c99_support_win.h"
46 #include "platform/inttypes_support_win.h" 48 #include "platform/inttypes_support_win.h"
47 #endif 49 #endif
48 50
49
50 // Target OS detection. 51 // Target OS detection.
51 // for more information on predefined macros: 52 // for more information on predefined macros:
52 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx 53 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx
53 // - with gcc, run: "echo | gcc -E -dM -" 54 // - with gcc, run: "echo | gcc -E -dM -"
54 #if defined(__linux__) || defined(__FreeBSD__) 55 #if defined(__linux__) || defined(__FreeBSD__)
55 #define TARGET_OS_LINUX 1 56 #define TARGET_OS_LINUX 1
56 #elif defined(__APPLE__) 57 #elif defined(__APPLE__)
57 #define TARGET_OS_MACOS 1 58 #define TARGET_OS_MACOS 1
58 #elif defined(_WIN32) 59 #elif defined(_WIN32)
59 #define TARGET_OS_WINDOWS 1 60 #define TARGET_OS_WINDOWS 1
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // used in the private: declarations for a class that wants to prevent 186 // used in the private: declarations for a class that wants to prevent
186 // anyone from instantiating it. This is especially useful for classes 187 // anyone from instantiating it. This is especially useful for classes
187 // containing only static methods. 188 // containing only static methods.
188 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ 189 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
189 private: \ 190 private: \
190 TypeName(); \ 191 TypeName(); \
191 DISALLOW_COPY_AND_ASSIGN(TypeName) 192 DISALLOW_COPY_AND_ASSIGN(TypeName)
192 193
193 194
194 // Macro to disallow allocation in the C++ heap. This should be used 195 // Macro to disallow allocation in the C++ heap. This should be used
195 // in the private section for a class. 196 // in the private section for a class. Don't use UNREACHABLE here to
197 // avoid circular dependencies between platform/globals.h and
198 // platform/assert.h.
196 #define DISALLOW_ALLOCATION() \ 199 #define DISALLOW_ALLOCATION() \
197 public: \ 200 public: \
198 void operator delete(void* pointer) { UNREACHABLE(); } \ 201 void operator delete(void* pointer) { \
202 fprintf(stderr, "unreachable code\n"); \
203 std::abort(); \
204 } \
199 private: \ 205 private: \
200 void* operator new(size_t size); 206 void* operator new(size_t size);
201 207
202 208
203 // The USE(x) template is used to silence C++ compiler warnings issued 209 // The USE(x) template is used to silence C++ compiler warnings issued
204 // for unused variables. 210 // for unused variables.
205 template <typename T> 211 template <typename T>
206 static inline void USE(T) { } 212 static inline void USE(T) { }
207 213
208 214
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // separate lines with body in {}s). 331 // separate lines with body in {}s).
326 # define TEMP_FAILURE_RETRY(expression) \ 332 # define TEMP_FAILURE_RETRY(expression) \
327 ({ int64_t __result; \ 333 ({ int64_t __result; \
328 do { \ 334 do { \
329 __result = (int64_t) (expression); \ 335 __result = (int64_t) (expression); \
330 } while (__result == -1L && errno == EINTR); \ 336 } while (__result == -1L && errno == EINTR); \
331 __result; }) 337 __result; })
332 #endif 338 #endif
333 339
334 #endif // PLATFORM_GLOBALS_H_ 340 #endif // PLATFORM_GLOBALS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698