]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Recent GCCs (3.4+ at least) optimize static unused functions out, so
authorJulian Seward <jseward@acm.org>
Wed, 12 Apr 2006 17:15:35 +0000 (17:15 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 12 Apr 2006 17:15:35 +0000 (17:15 +0000)
making VALGRIND_PRINTF and VALGRIND_PRINTF_BACKTRACE static and
attribute unused proved to be much better than always compiling it as
exported weak function.  (Jakub Jelinek)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5845

include/valgrind.h

index a719b20d1af17bd5da518867b7c50ef65afdb14f..b5c8222b4acaa624da84d05163b99e5e98e37720 100644 (file)
@@ -2338,10 +2338,11 @@ typedef
 
 #else /* NVALGRIND */
 
-int VALGRIND_PRINTF(const char *format, ...)
-   __attribute__((format(__printf__, 1, 2)));
-__attribute__((weak))
-int
+/* Modern GCC will optimize the static routine out if unused,
+   and unused attribute will shut down warnings about it.  */
+static int VALGRIND_PRINTF(const char *format, ...)
+   __attribute__((format(__printf__, 1, 2), __unused__));
+static int
 VALGRIND_PRINTF(const char *format, ...)
 {
    unsigned long _qzz_res;
@@ -2354,10 +2355,9 @@ VALGRIND_PRINTF(const char *format, ...)
    return (int)_qzz_res;
 }
 
-int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
-   __attribute__((format(__printf__, 1, 2)));
-__attribute__((weak))
-int
+static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
+   __attribute__((format(__printf__, 1, 2), __unused__));
+static int
 VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
 {
    unsigned long _qzz_res;