41 |
41 |
42 // Use resource area for buffer |
42 // Use resource area for buffer |
43 #define RES_BUFSZ 256 |
43 #define RES_BUFSZ 256 |
44 class FormatBufferResource : public FormatBufferBase { |
44 class FormatBufferResource : public FormatBufferBase { |
45 public: |
45 public: |
46 FormatBufferResource(const char * format, ...); |
46 FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); |
47 }; |
47 }; |
48 |
48 |
49 // Use stack for buffer |
49 // Use stack for buffer |
50 template <size_t bufsz = 256> |
50 template <size_t bufsz = 256> |
51 class FormatBuffer : public FormatBufferBase { |
51 class FormatBuffer : public FormatBufferBase { |
52 public: |
52 public: |
53 inline FormatBuffer(const char * format, ...); |
53 inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); |
54 inline void append(const char* format, ...); |
54 inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
55 inline void print(const char* format, ...); |
55 inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
56 inline void printv(const char* format, va_list ap); |
56 inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); |
57 |
57 |
58 char* buffer() { return _buf; } |
58 char* buffer() { return _buf; } |
59 int size() { return bufsz; } |
59 int size() { return bufsz; } |
60 |
60 |
61 private: |
61 private: |
221 void report_should_not_call(const char* file, int line); |
221 void report_should_not_call(const char* file, int line); |
222 void report_should_not_reach_here(const char* file, int line); |
222 void report_should_not_reach_here(const char* file, int line); |
223 void report_unimplemented(const char* file, int line); |
223 void report_unimplemented(const char* file, int line); |
224 void report_untested(const char* file, int line, const char* message); |
224 void report_untested(const char* file, int line, const char* message); |
225 |
225 |
226 void warning(const char* format, ...); |
226 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); |
227 |
227 |
228 #ifdef ASSERT |
228 #ifdef ASSERT |
229 // Compile-time asserts. |
229 // Compile-time asserts. |
230 template <bool> struct StaticAssert; |
230 template <bool> struct StaticAssert; |
231 template <> struct StaticAssert<true> {}; |
231 template <> struct StaticAssert<true> {}; |