OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 26 matching lines...) Expand all Loading... |
37 // ---------------------------------------------------------------------------- | 37 // ---------------------------------------------------------------------------- |
38 // I/O support. | 38 // I/O support. |
39 | 39 |
40 #if __GNUC__ >= 4 | 40 #if __GNUC__ >= 4 |
41 // On gcc we can ask the compiler to check the types of %d-style format | 41 // On gcc we can ask the compiler to check the types of %d-style format |
42 // specifiers and their associated arguments. TODO(erikcorry) fix this | 42 // specifiers and their associated arguments. TODO(erikcorry) fix this |
43 // so it works on MacOSX. | 43 // so it works on MacOSX. |
44 #if defined(__MACH__) && defined(__APPLE__) | 44 #if defined(__MACH__) && defined(__APPLE__) |
45 #define PRINTF_CHECKING | 45 #define PRINTF_CHECKING |
46 #define FPRINTF_CHECKING | 46 #define FPRINTF_CHECKING |
| 47 #define PRINTF_METHOD_CHECKING |
| 48 #define FPRINTF_METHOD_CHECKING |
47 #else // MacOsX. | 49 #else // MacOsX. |
48 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) | 50 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) |
49 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3))) | 51 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3))) |
| 52 #define PRINTF_METHOD_CHECKING __attribute__ ((format (printf, 2, 3))) |
| 53 #define FPRINTF_METHOD_CHECKING __attribute__ ((format (printf, 3, 4))) |
50 #endif | 54 #endif |
51 #else | 55 #else |
52 #define PRINTF_CHECKING | 56 #define PRINTF_CHECKING |
53 #define FPRINTF_CHECKING | 57 #define FPRINTF_CHECKING |
| 58 #define PRINTF_METHOD_CHECKING |
| 59 #define FPRINTF_METHOD_CHECKING |
54 #endif | 60 #endif |
55 | 61 |
56 // Our version of printf(). | 62 // Our version of printf(). |
57 void PRINTF_CHECKING PrintF(const char* format, ...); | 63 void PRINTF_CHECKING PrintF(const char* format, ...); |
58 void FPRINTF_CHECKING PrintF(FILE* out, const char* format, ...); | 64 void FPRINTF_CHECKING PrintF(FILE* out, const char* format, ...); |
59 | 65 |
60 // Prepends the current process ID to the output. | 66 // Prepends the current process ID to the output. |
61 void PRINTF_CHECKING PrintPID(const char* format, ...); | 67 void PRINTF_CHECKING PrintPID(const char* format, ...); |
62 | 68 |
63 // Our version of fflush. | 69 // Our version of fflush. |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 466 |
461 // Add formatted contents like printf based on a va_list. | 467 // Add formatted contents like printf based on a va_list. |
462 void AddFormattedList(const char* format, va_list list); | 468 void AddFormattedList(const char* format, va_list list); |
463 private: | 469 private: |
464 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | 470 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
465 }; | 471 }; |
466 | 472 |
467 } } // namespace v8::internal | 473 } } // namespace v8::internal |
468 | 474 |
469 #endif // V8_V8UTILS_H_ | 475 #endif // V8_V8UTILS_H_ |
OLD | NEW |