* error: undefined identifier '__builtin_va_arg_pack' @ 2013-07-18 12:47 Jeff Layton 2013-07-18 15:36 ` [PATCH] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() Jeff Layton 0 siblings, 1 reply; 5+ messages in thread From: Jeff Layton @ 2013-07-18 12:47 UTC (permalink / raw) To: linux-sparse I was running sparse on some code I maintain and saw a bunch of warnings like this: /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> It looks like gcc defines this in recent versions: http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html It seems like something like this might do the trick for __builtin_va_arg_pack_len: -----------------[snip]------------------ diff --git a/lib.c b/lib.c index 7e822eb..db981d8 100644 --- a/lib.c +++ b/lib.c @@ -779,6 +779,7 @@ void declare_builtin_functions(void) add_pre_buffer("extern double __builtin_fabs(double);\n"); add_pre_buffer("extern void __sync_synchronize();\n"); add_pre_buffer("extern int __sync_bool_compare_and_swap(void *, ...);\n"); + add_pre_buffer("extern size_t __builtin_va_arg_pack_len(void);\n"); /* Add Blackfin-specific stuff */ add_pre_buffer( -----------------[snip]------------------ ...but I'm unclear on how best to fix the errors around __builtin_va_arg_pack since it doesn't seem to return a well-defined type. Thanks... -- Jeff Layton <jlayton@redhat.com> ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() 2013-07-18 12:47 error: undefined identifier '__builtin_va_arg_pack' Jeff Layton @ 2013-07-18 15:36 ` Jeff Layton 2013-07-19 2:49 ` Christopher Li 0 siblings, 1 reply; 5+ messages in thread From: Jeff Layton @ 2013-07-18 15:36 UTC (permalink / raw) To: linux-sparse; +Cc: Christopher Li, Pekka Enberg 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> Probably, there is some better way to do this that actually validates this function, but I'm not clear on how to do it. Signed-off-by: Jeff Layton <jlayton@redhat.com> --- lib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib.c b/lib.c index 7e822eb..3f687ae 100644 --- a/lib.c +++ b/lib.c @@ -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"); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() 2013-07-18 15:36 ` [PATCH] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() Jeff Layton @ 2013-07-19 2:49 ` Christopher Li 2013-07-19 10:33 ` [PATCH v2] " Jeff Layton 0 siblings, 1 reply; 5+ messages in thread From: Christopher Li @ 2013-07-19 2:49 UTC (permalink / raw) To: Jeff Layton; +Cc: Linux-Sparse, Pekka Enberg On Thu, Jul 18, 2013 at 8:36 AM, Jeff Layton <jlayton@redhat.com> wrote: > 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> > > Probably, there is some better way to do this that actually validates > this function, but I'm not clear on how to do it. > Please add a test case for the typical usage case of __buildin_va_arg_pack() and __builtin_va_arg_pack_len(). At the very least, it needs to cover the real world breakage that bother you enough to submit a patch. The patch looks good otherwise. Thanks Chris ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() 2013-07-19 2:49 ` Christopher Li @ 2013-07-19 10:33 ` Jeff Layton 2013-07-24 16:41 ` Christopher Li 0 siblings, 1 reply; 5+ messages in thread From: Jeff Layton @ 2013-07-19 10:33 UTC (permalink / raw) To: linux-sparse; +Cc: penberg, sparse 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 diff --git a/lib.c b/lib.c index 7e822eb..3f687ae 100644 --- a/lib.c +++ b/lib.c @@ -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"); diff --git a/validation/builtin_va_arg_pack.c b/validation/builtin_va_arg_pack.c new file mode 100644 index 0000000..3426b86 --- /dev/null +++ b/validation/builtin_va_arg_pack.c @@ -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() + */ -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() 2013-07-19 10:33 ` [PATCH v2] " Jeff Layton @ 2013-07-24 16:41 ` Christopher Li 0 siblings, 0 replies; 5+ messages in thread From: Christopher Li @ 2013-07-24 16:41 UTC (permalink / raw) To: Jeff Layton; +Cc: linux-sparse, penberg On Fri, Jul 19, 2013 at 3:33 AM, Jeff Layton <jlayton@redhat.com> wrote: > 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> Looks good, will apply. Chris ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-24 16:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-18 12:47 error: undefined identifier '__builtin_va_arg_pack' Jeff Layton 2013-07-18 15:36 ` [PATCH] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() Jeff Layton 2013-07-19 2:49 ` Christopher Li 2013-07-19 10:33 ` [PATCH v2] " Jeff Layton 2013-07-24 16:41 ` Christopher Li
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).