[tor-commits] [tor/master] Enable the -Waggregate-return warning

nickm at torproject.org nickm at torproject.org
Sat Jun 11 14:16:58 UTC 2016


commit ce1dbbc4fdd7ab6fab4f31a0e54d9ca97afe74a9
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri May 27 11:26:14 2016 -0400

    Enable the -Waggregate-return warning
    
    Suppress it in the one spot in the code where we actually do want to
    allow an aggregate return in order to call the mallinfo() API.
---
 configure.ac      | 3 +--
 src/common/util.c | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 29715c1..d922eb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1698,8 +1698,7 @@ if test "x$enable_gcc_warnings_advisory" != "xno"; then
   CFLAGS="$CFLAGS -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2"
   CFLAGS="$CFLAGS -Wwrite-strings -Wmissing-declarations -Wredundant-decls"
   CFLAGS="$CFLAGS -Wnested-externs -Wbad-function-cast -Wswitch-enum"
-
-  # Disabled, so we can use mallinfo(): -Waggregate-return
+  CFLAGS="$CFLAGS -Waggregate-return"
 
   if test "x$have_gcc4" = "xyes"; then
     # These warnings break gcc 3.3.5 and work on gcc 4.0.2
diff --git a/src/common/util.c b/src/common/util.c
index 78afe59..925431d 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -342,6 +342,7 @@ tor_free_(void *mem)
   tor_free(mem);
 }
 
+DISABLE_GCC_WARNING(aggregate-return)
 /** Call the platform malloc info function, and dump the results to the log at
  * level <b>severity</b>.  If no such function exists, do nothing. */
 void
@@ -369,6 +370,7 @@ tor_log_mallinfo(int severity)
                       );
 #endif
 }
+ENABLE_GCC_WARNING(aggregate-return)
 
 /* =====
  * Math





More information about the tor-commits mailing list