summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralkondratenko@gmail.com <alkondratenko@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2013-07-06 21:54:34 +0000
committeralkondratenko@gmail.com <alkondratenko@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2013-07-06 21:54:34 +0000
commite54971d58641853a9515d9f0313645729eab113a (patch)
treef83271d09994742c2e56e7eb7cd2351924697590
parent7dd038d7c58c9de889e3fcc552161533ea1baab1 (diff)
downloadgperftools-e54971d58641853a9515d9f0313645729eab113a.tar.gz
issue-534: fixed a number of gcc warnings
This applies patch from Adhemerval Zanella. git-svn-id: http://gperftools.googlecode.com/svn/trunk@221 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
-rw-r--r--src/base/basictypes.h8
-rw-r--r--src/heap-profiler.cc2
-rw-r--r--src/profiler.cc2
-rw-r--r--src/tests/heap-checker_unittest.cc5
-rw-r--r--src/tests/page_heap_test.cc1
5 files changed, 12 insertions, 6 deletions
diff --git a/src/base/basictypes.h b/src/base/basictypes.h
index dbb5162..bdea488 100644
--- a/src/base/basictypes.h
+++ b/src/base/basictypes.h
@@ -185,8 +185,14 @@ template <bool>
struct CompileAssert {
};
+#ifdef HAVE___ATTRIBUTE__
+# define ATTRIBUTE_UNUSED __attribute__((unused))
+#else
+# define ATTRIBUTE_UNUSED
+#endif
+
#define COMPILE_ASSERT(expr, msg) \
- typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+ typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED
#define arraysize(a) (sizeof(a) / sizeof(*(a)))
diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc
index 532d0f2..f1f2c21 100644
--- a/src/heap-profiler.cc
+++ b/src/heap-profiler.cc
@@ -293,7 +293,7 @@ static void MaybeDumpProfileLocked() {
} else if (FLAGS_heap_profile_time_interval > 0 &&
current_time - last_dump_time >=
FLAGS_heap_profile_time_interval) {
- snprintf(buf, sizeof(buf), "%d sec since the last dump",
+ snprintf(buf, sizeof(buf), "%" PRId64 " sec since the last dump",
current_time - last_dump_time);
need_to_dump = true;
last_dump_time = current_time;
diff --git a/src/profiler.cc b/src/profiler.cc
index a850bb7..ccbeeff 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
@@ -205,7 +205,7 @@ CpuProfiler::CpuProfiler()
if (signal_number_str != NULL)
{
long int signal_number = strtol(signal_number_str, NULL, 10);
- printf("<debug> signal_number=%d\n", signal_number);
+ printf("<debug> signal_number=%ld\n", signal_number);
if (signal_number >=1 && signal_number <=64)
{
sighandler_t old_signal_handler = signal(signal_number, CpuProfilerSwitch);
diff --git a/src/tests/heap-checker_unittest.cc b/src/tests/heap-checker_unittest.cc
index ab326c9..75c05f8 100644
--- a/src/tests/heap-checker_unittest.cc
+++ b/src/tests/heap-checker_unittest.cc
@@ -338,7 +338,7 @@ static void DoRunHidden(Closure* c, int n) {
VLOG(10) << "Wipe level " << n << " at " << &n;
if (n) {
const int sz = 30;
- volatile int arr[sz];
+ volatile int arr[sz] ATTRIBUTE_UNUSED;
for (int i = 0; i < sz; ++i) arr[i] = 0;
(*wipe_stack_ptr)(n-1);
sleep(0); // undo -foptimize-sibling-calls
@@ -570,7 +570,8 @@ static void TestHiddenPointer() {
// the xor trick itself works, as without it nothing in this
// test suite would work. See the Hide/Unhide/*Hidden* set
// of helper methods.
- CHECK_NE(foo, *reinterpret_cast<void**>(&p));
+ void **pvoid = reinterpret_cast<void**>(&p);
+ CHECK_NE(foo, *pvoid);
}
// simple tests that deallocate what they allocated
diff --git a/src/tests/page_heap_test.cc b/src/tests/page_heap_test.cc
index f08387c..5bd803d 100644
--- a/src/tests/page_heap_test.cc
+++ b/src/tests/page_heap_test.cc
@@ -43,7 +43,6 @@ static void TestPageHeap_Stats() {
// Split span 's1' into 's1', 's2'. Delete 's2'
tcmalloc::Span* s2 = ph->Split(s1, 128);
- Length s2_len = s2->length;
ph->Delete(s2);
CheckStats(ph, 256, 128, 0);