[cfe-dev] Tiny patch for va_list definition on x86-64 target

Eli Friedman eli.friedman at gmail.com
Thu Jul 2 17:46:31 PDT 2009


On Thu, Jul 2, 2009 at 4:08 PM, Abramo Bagnara<abramobagnara at tin.it> wrote:
> - implicit casts:
>
>  va_list ap;
>  va_start(ap, fmt);
>  int i = va_arg(ap, fmt);
>
>  becomes:
>
>  va_list ap;
>  __builtin_va_start((struct __va_list_tag*)(ap), fmt);
>  int i = __builtin_va_arg((struct __va_list_tag*)(ap), int);
>
> - function types:
>
>  int (*fun)(const char *fmt, va_list args);
>
>  becomes:
>
>  int (*fun)(const char *, struct __va_list_tag*);

Neither of these examples prints in the indicated way using clang-cc
-ast-print, but I guess you're using some customized code?

>>> With this patch, instead, va_list decays to __va_list_tag_t* that is
>>> easily mappable to gcc internal type for va_list.
>>
>> Why __va_list_tag_t instead of __va_list_tag (which is what gcc uses)?
>
> Just to have a different name for struct tag and typedef name, but
> perhaps this does not give anything.
>
> Here attached you can find a patch where it's used the same name.
>
>> Otherwise, the patch looks fine.
>
> Perfect, thanks for the review.

Committed in r74752.

-Eli




More information about the cfe-dev mailing list