]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Compile using -Winline to identify problematic functions
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 4 May 2017 15:29:35 +0000 (15:29 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 5 Jun 2017 10:47:39 +0000 (11:47 +0100)
A static inline function which can't be inlined for whatever reason ends up
being duplicated in all translation units in which it is used.

-Winline identifies why functions weren't inlined; snprintf() for example,
because it is varadic.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
build/common.mk
build/files.mk
common/libc/stdio.c [new file with mode: 0644]
include/xtf/libc.h

index 2cfe38679cb04ee82450ac56565ee968ecc1af31..f1de8000f59fd359228bd788c897b7e83bcdebf5 100644 (file)
@@ -27,7 +27,7 @@ COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g
 COMMON_CFLAGS += -fno-common -fno-asynchronous-unwind-tables -fno-strict-aliasing
 COMMON_CFLAGS += -fno-stack-protector -ffreestanding
 COMMON_CFLAGS += -mno-red-zone -mno-sse
-COMMON_CFLAGS += -Wno-unused-parameter
+COMMON_CFLAGS += -Wno-unused-parameter -Winline
 
 COMMON_AFLAGS-x86_32 := -m32
 COMMON_AFLAGS-x86_64 := -m64
index 64f43430d2ae4f3e680627cc0cde8b131e4882e4..a179f27b67ec84d5e3bda10da4ede1e562d2b35e 100644 (file)
@@ -9,6 +9,7 @@ obj-perarch += $(ROOT)/common/exlog.o
 obj-perarch += $(ROOT)/common/extable.o
 obj-perarch += $(ROOT)/common/heapsort.o
 obj-perarch += $(ROOT)/common/lib.o
+obj-perarch += $(ROOT)/common/libc/stdio.o
 obj-perarch += $(ROOT)/common/libc/string.o
 obj-perarch += $(ROOT)/common/libc/vsnprintf.o
 obj-perarch += $(ROOT)/common/report.o
diff --git a/common/libc/stdio.c b/common/libc/stdio.c
new file mode 100644 (file)
index 0000000..5e6f930
--- /dev/null
@@ -0,0 +1,13 @@
+#include <xtf/libc.h>
+
+int snprintf(char *buf, size_t size, const char *fmt, ...)
+{
+    va_list args;
+    int rc;
+
+    va_start(args, fmt);
+    rc = vsnprintf(buf, size, fmt, args);
+    va_end(args);
+
+    return rc;
+}
index e699fe27966961d4f0bef4f5e4532aabb844280d..893f6b87556bdbd4648dff9124bf1470b8eb7dae 100644 (file)
@@ -30,18 +30,8 @@ int memcmp(const void *s1, const void *s2, size_t n);
 int __printf(3, 0)
     vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
 
-static inline int __printf(3, 4)
-    snprintf(char *buf, size_t size, const char *fmt, ...)
-{
-    va_list args;
-    int rc;
-
-    va_start(args, fmt);
-    rc = vsnprintf(buf, size, fmt, args);
-    va_end(args);
-
-    return rc;
-}
+int __printf(3, 4)
+    snprintf(char *buf, size_t size, const char *fmt, ...);
 
 #endif /* XTF_LIBC_H */