Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: runtime/vm/os.h

Issue 10869063: Add attributions so printf like functions can have their arguments checked. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 VM_OS_H_ 5 #ifndef VM_OS_H_
6 #define VM_OS_H_ 6 #define VM_OS_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 9
10 // Forward declarations. 10 // Forward declarations.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Returns the stack size limit. 55 // Returns the stack size limit.
56 static uword GetStackSizeLimit(); 56 static uword GetStackSizeLimit();
57 57
58 // Returns number of available processor cores. 58 // Returns number of available processor cores.
59 static int NumberOfAvailableProcessors(); 59 static int NumberOfAvailableProcessors();
60 60
61 // Sleep the currently executing thread for millis ms. 61 // Sleep the currently executing thread for millis ms.
62 static void Sleep(int64_t millis); 62 static void Sleep(int64_t millis);
63 63
64 // Print formatted output to stdout/stderr for debugging. 64 // Print formatted output to stdout/stderr for debugging.
65 static void Print(const char* format, ...); 65 static void Print(const char* format, ...) PRINTF_ATTRIBUTE(1, 2);
66 static void PrintErr(const char* format, ...); 66 static void PrintErr(const char* format, ...) PRINTF_ATTRIBUTE(1, 2);
67 static void VFPrint(FILE* stream, const char* format, va_list args); 67 static void VFPrint(FILE* stream, const char* format, va_list args);
68 // Print formatted output info a buffer. 68 // Print formatted output info a buffer.
69 // 69 //
70 // Does not write more than size characters (including the trailing '\0'). 70 // Does not write more than size characters (including the trailing '\0').
71 // 71 //
72 // Returns the number of characters (excluding the trailing '\0') 72 // Returns the number of characters (excluding the trailing '\0')
73 // that would been written if the buffer had been big enough. If 73 // that would been written if the buffer had been big enough. If
74 // the return value is greater or equal than the given size then the 74 // the return value is greater or equal than the given size then the
75 // output has been truncated. The return value is never negative. 75 // output has been truncated. The return value is never negative.
76 // 76 //
77 // The buffer will always be terminated by a '\0', unless the buffer 77 // The buffer will always be terminated by a '\0', unless the buffer
78 // is of size 0. The buffer might be NULL if the size is 0. 78 // is of size 0. The buffer might be NULL if the size is 0.
79 // 79 //
80 // This specification conforms to C99 standard which is implemented 80 // This specification conforms to C99 standard which is implemented
81 // by glibc 2.1+ with one exception: the C99 standard allows a 81 // by glibc 2.1+ with one exception: the C99 standard allows a
82 // negative return value. We will terminate the vm rather than let 82 // negative return value. We will terminate the vm rather than let
83 // that occur. 83 // that occur.
84 static int SNPrint(char* str, size_t size, const char* format, ...); 84 static int SNPrint(char* str, size_t size, const char* format, ...)
85 PRINTF_ATTRIBUTE(3, 4);
85 static int VSNPrint(char* str, size_t size, 86 static int VSNPrint(char* str, size_t size,
86 const char* format, 87 const char* format,
87 va_list args); 88 va_list args);
88 89
89 // Converts a C string which represents a valid dart integer into a 64 bit 90 // Converts a C string which represents a valid dart integer into a 64 bit
90 // value. 91 // value.
91 // Returns false if it is unable to convert the string to a 64 bit value, 92 // Returns false if it is unable to convert the string to a 64 bit value,
92 // the failure could be because of underflow/overflow or invalid characters. 93 // the failure could be because of underflow/overflow or invalid characters.
93 // On success the function returns true and 'value' contains the converted 94 // On success the function returns true and 'value' contains the converted
94 // value. 95 // value.
95 static bool StringToInt64(const char* str, int64_t* value); 96 static bool StringToInt64(const char* str, int64_t* value);
96 97
97 // Initialize the OS class. 98 // Initialize the OS class.
98 static void InitOnce(); 99 static void InitOnce();
99 100
100 // Shut down the OS class. 101 // Shut down the OS class.
101 static void Shutdown(); 102 static void Shutdown();
102 103
103 static void Abort(); 104 static void Abort();
104 105
105 static void Exit(int code); 106 static void Exit(int code);
106 }; 107 };
107 108
108 } // namespace dart 109 } // namespace dart
109 110
110 #endif // VM_OS_H_ 111 #endif // VM_OS_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698