Mercurial > hg > truffle
comparison src/share/vm/utilities/debug.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 | e2722a66aba7 |
children | 52b4284cb496 03e6d34be1f5 |
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. |
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> {}; |