@@ -777,6 +777,7 @@ void declare_builtin_functions(void)
add_pre_buffer("extern long __builtin_alpha_cmpbge(long, long);\n");
add_pre_buffer("extern long __builtin_labs(long);\n");
add_pre_buffer("extern double __builtin_fabs(double);\n");
+ add_pre_buffer("extern __SIZE_TYPE__ __builtin_va_arg_pack_len(void);\n");
add_pre_buffer("extern void __sync_synchronize();\n");
add_pre_buffer("extern int __sync_bool_compare_and_swap(void *, ...);\n");
@@ -876,6 +877,7 @@ void create_builtin_stream(void)
add_pre_buffer("#define __builtin_va_copy(dest, src) ({ dest = src; (void)0; })\n");
add_pre_buffer("#define __builtin_va_end(arg)\n");
add_pre_buffer("#define __builtin_ms_va_end(arg)\n");
+ add_pre_buffer("#define __builtin_va_arg_pack()\n");
/* FIXME! We need to do these as special magic macros at expansion time! */
add_pre_buffer("#define __BASE_FILE__ \"base_file.c\"\n");
new file mode 100644
@@ -0,0 +1,20 @@
+extern void v(int a, ...);
+
+extern inline __attribute__((__always_inline__)) void f(int a, ...)
+{
+ __SIZE_TYPE__ b = __builtin_va_arg_pack_len();
+}
+
+extern inline __attribute__((__always_inline__)) void g(int a, ...)
+{
+ v(a, __builtin_va_arg_pack());
+}
+
+static void h(void)
+{
+ f(0, 0);
+ g(0, 0);
+}
+/*
+ * check-name: __builtin_va_arg_pack()
+ */
this patch stops sparse from complaining about them not being defined: /usr/include/bits/stdio2.h:98:25: error: undefined identifier '__builtin_va_arg_pack' /usr/include/bits/stdio2.h:98:25: error: not a function <noident> Signed-off-by: Jeff Layton <jlayton@redhat.com> --- lib.c | 2 ++ validation/builtin_va_arg_pack.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 validation/builtin_va_arg_pack.c