Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/ostream.hpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | f42c10a3d4b1 |
children | 52b4284cb496 0982ec23da03 |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
51 | 51 |
52 void update_position(const char* s, size_t len); | 52 void update_position(const char* s, size_t len); |
53 static const char* do_vsnprintf(char* buffer, size_t buflen, | 53 static const char* do_vsnprintf(char* buffer, size_t buflen, |
54 const char* format, va_list ap, | 54 const char* format, va_list ap, |
55 bool add_cr, | 55 bool add_cr, |
56 size_t& result_len); | 56 size_t& result_len) ATTRIBUTE_PRINTF(3, 0); |
57 | 57 |
58 public: | 58 public: |
59 // creation | 59 // creation |
60 outputStream(int width = 80); | 60 outputStream(int width = 80); |
61 outputStream(int width, bool has_time_stamps); | 61 outputStream(int width, bool has_time_stamps); |
78 julong count() const { return _precount + _position; } | 78 julong count() const { return _precount + _position; } |
79 void set_count(julong count) { _precount = count - _position; } | 79 void set_count(julong count) { _precount = count - _position; } |
80 void set_position(int pos) { _position = pos; } | 80 void set_position(int pos) { _position = pos; } |
81 | 81 |
82 // printing | 82 // printing |
83 void print(const char* format, ...); | 83 void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
84 void print_cr(const char* format, ...); | 84 void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
85 void vprint(const char *format, va_list argptr); | 85 void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); |
86 void vprint_cr(const char* format, va_list argptr); | 86 void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); |
87 void print_raw(const char* str) { write(str, strlen(str)); } | 87 void print_raw(const char* str) { write(str, strlen(str)); } |
88 void print_raw(const char* str, int len) { write(str, len); } | 88 void print_raw(const char* str, int len) { write(str, len); } |
89 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } | 89 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } |
90 void print_raw_cr(const char* str, int len){ write(str, len); cr(); } | 90 void print_raw_cr(const char* str, int len){ write(str, len); cr(); } |
91 void print_data(void* data, size_t len, bool with_ascii); | 91 void print_data(void* data, size_t len, bool with_ascii); |
273 staticBufferStream(char* buffer, size_t buflen, | 273 staticBufferStream(char* buffer, size_t buflen, |
274 outputStream *outer_stream); | 274 outputStream *outer_stream); |
275 ~staticBufferStream() {}; | 275 ~staticBufferStream() {}; |
276 virtual void write(const char* c, size_t len); | 276 virtual void write(const char* c, size_t len); |
277 void flush(); | 277 void flush(); |
278 void print(const char* format, ...); | 278 void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
279 void print_cr(const char* format, ...); | 279 void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
280 void vprint(const char *format, va_list argptr); | 280 void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); |
281 void vprint_cr(const char* format, va_list argptr); | 281 void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); |
282 }; | 282 }; |
283 | 283 |
284 // In the non-fixed buffer case an underlying buffer will be created and | 284 // In the non-fixed buffer case an underlying buffer will be created and |
285 // managed in C heap. Not MT-safe. | 285 // managed in C heap. Not MT-safe. |
286 class bufferedStream : public outputStream { | 286 class bufferedStream : public outputStream { |