OLD | NEW |
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 before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // See: http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx for an | 247 // See: http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx for an |
248 // explanation of some the cases when a function can never be inlined. | 248 // explanation of some the cases when a function can never be inlined. |
249 #ifdef _MSC_VER | 249 #ifdef _MSC_VER |
250 #define DART_FORCE_INLINE __forceinline | 250 #define DART_FORCE_INLINE __forceinline |
251 #elif __GNUC__ | 251 #elif __GNUC__ |
252 #define DART_FORCE_INLINE inline __attribute__((always_inline)) | 252 #define DART_FORCE_INLINE inline __attribute__((always_inline)) |
253 #else | 253 #else |
254 #error Automatic compiler detection failed. | 254 #error Automatic compiler detection failed. |
255 #endif | 255 #endif |
256 | 256 |
| 257 // DART_NOINLINE tells compiler to never inline a particular function. |
| 258 #ifdef _MSC_VER |
| 259 #define DART_NOINLINE __declspec(noinline) |
| 260 #elif __GNUC__ |
| 261 #define DART_NOINLINE __attribute__((noinline)) |
| 262 #else |
| 263 #error Automatic compiler detection failed. |
| 264 #endif |
| 265 |
257 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected | 266 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected |
258 // to be unused and disables the related warning. | 267 // to be unused and disables the related warning. |
259 #ifdef __GNUC__ | 268 #ifdef __GNUC__ |
260 #define DART_UNUSED __attribute__((unused)) | 269 #define DART_UNUSED __attribute__((unused)) |
261 #else | 270 #else |
262 #define DART_UNUSED | 271 #define DART_UNUSED |
263 #endif | 272 #endif |
264 | 273 |
265 // DART_NORETURN indicates to the compiler that a function doees not return. | 274 // DART_NORETURN indicates to the compiler that a function doees not return. |
266 // It should be used on functions that unconditionally call functions like | 275 // It should be used on functions that unconditionally call functions like |
267 // exit(), which end the program. We use it to avoid compiler warnings in | 276 // exit(), which end the program. We use it to avoid compiler warnings in |
268 // callers of DART_NORETURN functions. | 277 // callers of DART_NORETURN functions. |
269 #ifdef _MSC_VER | 278 #ifdef _MSC_VER |
270 #define DART_NORETURN __declspec(noreturn) | 279 #define DART_NORETURN __declspec(noreturn) |
271 #elif __GNUC__ | 280 #elif __GNUC__ |
272 #define DART_NORETURN __attribute__((noreturn)) | 281 #define DART_NORETURN __attribute__((noreturn)) |
273 #else | 282 #else |
274 #error Automatic compiler detection failed. | 283 #error Automatic compiler detection failed. |
275 #endif | 284 #endif |
276 | 285 |
277 #if !defined(TARGET_ARCH_MIPS) | 286 #if !defined(TARGET_ARCH_MIPS) |
278 #if !defined(TARGET_ARCH_ARM) | 287 #if !defined(TARGET_ARCH_ARM) |
279 #if !defined(TARGET_ARCH_X64) | 288 #if !defined(TARGET_ARCH_X64) |
280 #if !defined(TARGET_ARCH_IA32) | 289 #if !defined(TARGET_ARCH_IA32) |
281 #if !defined(TARGET_ARCH_ARM64) | 290 #if !defined(TARGET_ARCH_ARM64) |
| 291 #if !defined(TARGET_ARCH_DBC) |
282 // No target architecture specified pick the one matching the host architecture. | 292 // No target architecture specified pick the one matching the host architecture. |
283 #if defined(HOST_ARCH_MIPS) | 293 #if defined(HOST_ARCH_MIPS) |
284 #define TARGET_ARCH_MIPS 1 | 294 #define TARGET_ARCH_MIPS 1 |
285 #elif defined(HOST_ARCH_ARM) | 295 #elif defined(HOST_ARCH_ARM) |
286 #define TARGET_ARCH_ARM 1 | 296 #define TARGET_ARCH_ARM 1 |
287 #elif defined(HOST_ARCH_X64) | 297 #elif defined(HOST_ARCH_X64) |
288 #define TARGET_ARCH_X64 1 | 298 #define TARGET_ARCH_X64 1 |
289 #elif defined(HOST_ARCH_IA32) | 299 #elif defined(HOST_ARCH_IA32) |
290 #define TARGET_ARCH_IA32 1 | 300 #define TARGET_ARCH_IA32 1 |
291 #elif defined(HOST_ARCH_ARM64) | 301 #elif defined(HOST_ARCH_ARM64) |
292 #define TARGET_ARCH_ARM64 1 | 302 #define TARGET_ARCH_ARM64 1 |
293 #else | 303 #else |
294 #error Automatic target architecture detection failed. | 304 #error Automatic target architecture detection failed. |
295 #endif | 305 #endif |
296 #endif | 306 #endif |
297 #endif | 307 #endif |
298 #endif | 308 #endif |
299 #endif | 309 #endif |
300 #endif | 310 #endif |
| 311 #endif |
301 | 312 |
302 // Verify that host and target architectures match, we cannot | 313 // Verify that host and target architectures match, we cannot |
303 // have a 64 bit Dart VM generating 32 bit code or vice-versa. | 314 // have a 64 bit Dart VM generating 32 bit code or vice-versa. |
304 #if defined(TARGET_ARCH_X64) || \ | 315 #if defined(TARGET_ARCH_X64) || \ |
305 defined(TARGET_ARCH_ARM64) | 316 defined(TARGET_ARCH_ARM64) |
306 #if !defined(ARCH_IS_64_BIT) | 317 #if !defined(ARCH_IS_64_BIT) |
307 #error Mismatched Host/Target architectures. | 318 #error Mismatched Host/Target architectures. |
308 #endif | 319 #endif |
309 #elif defined(TARGET_ARCH_IA32) || \ | 320 #elif defined(TARGET_ARCH_IA32) || \ |
310 defined(TARGET_ARCH_ARM) || \ | 321 defined(TARGET_ARCH_ARM) || \ |
(...skipping 16 matching lines...) Expand all Loading... |
327 #elif defined(TARGET_ARCH_ARM64) | 338 #elif defined(TARGET_ARCH_ARM64) |
328 #if !defined(HOST_ARCH_ARM64) | 339 #if !defined(HOST_ARCH_ARM64) |
329 #define USING_SIMULATOR 1 | 340 #define USING_SIMULATOR 1 |
330 #endif | 341 #endif |
331 | 342 |
332 #elif defined(TARGET_ARCH_MIPS) | 343 #elif defined(TARGET_ARCH_MIPS) |
333 #if !defined(HOST_ARCH_MIPS) | 344 #if !defined(HOST_ARCH_MIPS) |
334 #define USING_SIMULATOR 1 | 345 #define USING_SIMULATOR 1 |
335 #endif | 346 #endif |
336 | 347 |
| 348 #elif defined(TARGET_ARCH_DBC) |
| 349 #define USING_SIMULATOR 1 |
| 350 |
337 #else | 351 #else |
338 #error Unknown architecture. | 352 #error Unknown architecture. |
339 #endif | 353 #endif |
340 | 354 |
341 | 355 |
342 // Short form printf format specifiers | 356 // Short form printf format specifiers |
343 #define Pd PRIdPTR | 357 #define Pd PRIdPTR |
344 #define Pu PRIuPTR | 358 #define Pu PRIuPTR |
345 #define Px PRIxPTR | 359 #define Px PRIxPTR |
346 #define Pd64 PRId64 | 360 #define Pd64 PRId64 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 657 |
644 #if defined(_WIN32) | 658 #if defined(_WIN32) |
645 #define STDIN_FILENO 0 | 659 #define STDIN_FILENO 0 |
646 #define STDOUT_FILENO 1 | 660 #define STDOUT_FILENO 1 |
647 #define STDERR_FILENO 2 | 661 #define STDERR_FILENO 2 |
648 #endif | 662 #endif |
649 | 663 |
650 } // namespace dart | 664 } // namespace dart |
651 | 665 |
652 #endif // PLATFORM_GLOBALS_H_ | 666 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |