|
From: <sv...@va...> - 2006-04-12 17:15:46
|
Author: sewardj
Date: 2006-04-12 18:15:35 +0100 (Wed, 12 Apr 2006)
New Revision: 5845
Log:
Recent GCCs (3.4+ at least) optimize static unused functions out, so
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)
Modified:
trunk/include/valgrind.h
Modified: trunk/include/valgrind.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/valgrind.h 2006-04-12 13:41:51 UTC (rev 5844)
+++ trunk/include/valgrind.h 2006-04-12 17:15:35 UTC (rev 5845)
@@ -2338,10 +2338,11 @@
=20
#else /* NVALGRIND */
=20
-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 @@
return (int)_qzz_res;
}
=20
-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;
|