OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 // ---------------------------------------------------------------------------- | 216 // ---------------------------------------------------------------------------- |
217 // Hash function. | 217 // Hash function. |
218 | 218 |
219 uint32_t ComputeIntegerHash(uint32_t key); | 219 uint32_t ComputeIntegerHash(uint32_t key); |
220 | 220 |
221 | 221 |
222 // ---------------------------------------------------------------------------- | 222 // ---------------------------------------------------------------------------- |
223 // I/O support. | 223 // I/O support. |
224 | 224 |
225 // Our version of printf(). Avoids compilation errors that we get | 225 #if __GNUC__ >= 4 |
226 // with standard printf when attempting to print pointers, etc. | 226 // On gcc we can ask the compiler to check the types of %d-style format |
227 // (the errors are due to the extra compilation flags, which we | 227 // specifiers and their associated arguments. TODO(erikcorry) fix this |
228 // want elsewhere). | 228 // so it works on MacOSX. |
229 void PrintF(const char* format, ...); | 229 #if defined(__MACH__) && defined(__APPLE__) |
| 230 #define PRINTF_CHECKING |
| 231 #else // MacOsX. |
| 232 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) |
| 233 #endif |
| 234 #else |
| 235 #define PRINTF_CHECKING |
| 236 #endif |
| 237 |
| 238 // Our version of printf(). |
| 239 void PRINTF_CHECKING PrintF(const char* format, ...); |
230 | 240 |
231 // Our version of fflush. | 241 // Our version of fflush. |
232 void Flush(); | 242 void Flush(); |
233 | 243 |
234 | 244 |
235 // Read a line of characters after printing the prompt to stdout. The resulting | 245 // Read a line of characters after printing the prompt to stdout. The resulting |
236 // char* needs to be disposed off with DeleteArray by the caller. | 246 // char* needs to be disposed off with DeleteArray by the caller. |
237 char* ReadLine(const char* prompt); | 247 char* ReadLine(const char* prompt); |
238 | 248 |
239 | 249 |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 } | 963 } |
954 | 964 |
955 template <class Dest, class Source> | 965 template <class Dest, class Source> |
956 inline Dest BitCast(Source* source) { | 966 inline Dest BitCast(Source* source) { |
957 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 967 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
958 } | 968 } |
959 | 969 |
960 } } // namespace v8::internal | 970 } } // namespace v8::internal |
961 | 971 |
962 #endif // V8_UTILS_H_ | 972 #endif // V8_UTILS_H_ |
OLD | NEW |