OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 #elif V8_HAS___ALIGNOF__ | 437 #elif V8_HAS___ALIGNOF__ |
438 # define V8_ALIGNOF(type) __alignof__(type) | 438 # define V8_ALIGNOF(type) __alignof__(type) |
439 #else | 439 #else |
440 // Note that alignment of a type within a struct can be less than the | 440 // Note that alignment of a type within a struct can be less than the |
441 // alignment of the type stand-alone (because of ancient ABIs), so this | 441 // alignment of the type stand-alone (because of ancient ABIs), so this |
442 // should only be used as a last resort. | 442 // should only be used as a last resort. |
443 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } | 443 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } |
444 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) | 444 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) |
445 #endif | 445 #endif |
446 | 446 |
| 447 |
| 448 // This macro accepts another macro or a string and converts it into a string |
| 449 // after preprocessor argument expansion. |
| 450 // Use like: |
| 451 // #define AGE 42 |
| 452 // const gchar* greeting = V8_STRINGIFY(AGE) " today!"; |
| 453 #define V8_STRINGIFY(macro_or_string) V8_STRINGIFY_ARG(macro_or_string) |
| 454 #define V8_STRINGIFY_ARG(contents) #contents |
| 455 |
447 #endif // V8CONFIG_H_ | 456 #endif // V8CONFIG_H_ |
OLD | NEW |