comparison src/share/vm/services/heapDumper.cpp @ 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 539144972c1e
children 52b4284cb496
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 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.
1828 } 1828 }
1829 } 1829 }
1830 } 1830 }
1831 1831
1832 // dump the heap to given path. 1832 // dump the heap to given path.
1833 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
1833 int HeapDumper::dump(const char* path) { 1834 int HeapDumper::dump(const char* path) {
1834 assert(path != NULL && strlen(path) > 0, "path missing"); 1835 assert(path != NULL && strlen(path) > 0, "path missing");
1835 1836
1836 // print message in interactive case 1837 // print message in interactive case
1837 if (print_to_tty()) { 1838 if (print_to_tty()) {
1868 timer()->stop(); 1869 timer()->stop();
1869 if (error() == NULL) { 1870 if (error() == NULL) {
1870 char msg[256]; 1871 char msg[256];
1871 sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", 1872 sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
1872 JLONG_FORMAT, timer()->seconds()); 1873 JLONG_FORMAT, timer()->seconds());
1874 PRAGMA_DIAG_PUSH
1875 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
1873 tty->print_cr(msg, writer.bytes_written()); 1876 tty->print_cr(msg, writer.bytes_written());
1877 PRAGMA_DIAG_POP
1874 } else { 1878 } else {
1875 tty->print_cr("Dump file is incomplete: %s", writer.error()); 1879 tty->print_cr("Dump file is incomplete: %s", writer.error());
1876 } 1880 }
1877 } 1881 }
1878 1882