comparison src/share/vm/utilities/xmlstream.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 da91efe96a93
children
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 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.
78 78
79 // protect this from public use: 79 // protect this from public use:
80 outputStream* out() { return _out; } 80 outputStream* out() { return _out; }
81 81
82 // helpers for writing XML elements 82 // helpers for writing XML elements
83 void va_tag(bool push, const char* format, va_list ap); 83 void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
84 virtual void see_tag(const char* tag, bool push) NOT_DEBUG({}); 84 virtual void see_tag(const char* tag, bool push) NOT_DEBUG({});
85 virtual void pop_tag(const char* tag) NOT_DEBUG({}); 85 virtual void pop_tag(const char* tag) NOT_DEBUG({});
86 86
87 #ifdef ASSERT 87 #ifdef ASSERT
88 // in debug mode, we verify matching of opening and closing tags 88 // in debug mode, we verify matching of opening and closing tags
107 virtual void write(const char* s, size_t len); 107 virtual void write(const char* s, size_t len);
108 void write_text(const char* s, size_t len); // used by xmlTextStream 108 void write_text(const char* s, size_t len); // used by xmlTextStream
109 int unflushed_count() { return (int)(out()->count() - _last_flush); } 109 int unflushed_count() { return (int)(out()->count() - _last_flush); }
110 110
111 // writing complete XML elements 111 // writing complete XML elements
112 void elem(const char* format, ...); 112 void elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
113 void begin_elem(const char* format, ...); 113 void begin_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
114 void end_elem(const char* format, ...); 114 void end_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
115 void end_elem(); 115 void end_elem();
116 void head(const char* format, ...); 116 void head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
117 void begin_head(const char* format, ...); 117 void begin_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
118 void end_head(const char* format, ...); 118 void end_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
119 void end_head(); 119 void end_head();
120 void done(const char* format, ...); // xxx_done event, plus tail 120 void done(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // xxx_done event, plus tail
121 void done_raw(const char * kind); 121 void done_raw(const char * kind);
122 void tail(const char* kind); 122 void tail(const char* kind);
123 123
124 // va_list versions 124 // va_list versions
125 void va_elem(const char* format, va_list ap); 125 void va_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
126 void va_begin_elem(const char* format, va_list ap); 126 void va_begin_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
127 void va_head(const char* format, va_list ap); 127 void va_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
128 void va_begin_head(const char* format, va_list ap); 128 void va_begin_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
129 void va_done(const char* format, va_list ap); 129 void va_done(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
130 130
131 // write text (with quoting of special XML characters <>&'" etc.) 131 // write text (with quoting of special XML characters <>&'" etc.)
132 outputStream* text() { return _text; } 132 outputStream* text() { return _text; }
133 void text(const char* format, ...); 133 void text(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
134 void va_text(const char* format, va_list ap) { 134 void va_text(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) {
135 text()->vprint(format, ap); 135 text()->vprint(format, ap);
136 } 136 }
137 137
138 // commonly used XML attributes 138 // commonly used XML attributes
139 void stamp(); // stamp='1.234' 139 void stamp(); // stamp='1.234'