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 #if __GNUC__ >= 4 |
| 226 // On gcc we can ask the compiler to check the types of %d-style format |
| 227 // specifiers and their associated arguments. |
| 228 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2))) |
| 229 #else |
| 230 #define PRINTF_CHECKING |
| 231 #endif |
| 232 |
225 // Our version of printf(). Avoids compilation errors that we get | 233 // Our version of printf(). Avoids compilation errors that we get |
226 // with standard printf when attempting to print pointers, etc. | 234 // with standard printf when attempting to print pointers, etc. |
227 // (the errors are due to the extra compilation flags, which we | 235 // (the errors are due to the extra compilation flags, which we |
228 // want elsewhere). | 236 // want elsewhere). |
229 void PrintF(const char* format, ...); | 237 void PRINTF_CHECKING PrintF(const char* format, ...); |
230 | 238 |
231 // Our version of fflush. | 239 // Our version of fflush. |
232 void Flush(); | 240 void Flush(); |
233 | 241 |
234 | 242 |
235 // Read a line of characters after printing the prompt to stdout. The resulting | 243 // 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. | 244 // char* needs to be disposed off with DeleteArray by the caller. |
237 char* ReadLine(const char* prompt); | 245 char* ReadLine(const char* prompt); |
238 | 246 |
239 | 247 |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 } | 961 } |
954 | 962 |
955 template <class Dest, class Source> | 963 template <class Dest, class Source> |
956 inline Dest BitCast(Source* source) { | 964 inline Dest BitCast(Source* source) { |
957 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 965 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
958 } | 966 } |
959 | 967 |
960 } } // namespace v8::internal | 968 } } // namespace v8::internal |
961 | 969 |
962 #endif // V8_UTILS_H_ | 970 #endif // V8_UTILS_H_ |
OLD | NEW |