This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Ok, here is a first (tree-)checker for the va_args library (stdargs.h), with a test example to be included in the testsuite. Nic. On Saturday 14 April 2007 13:03, Sebastian Pop wrote: > Thanks for the catch. Fixed on graphite branch with the attached patch. > After review, I will add this fix to the patch for trunk before committing.
Attachment:
va.crp
Description: Text document
#include <stdio.h> #include <stdarg.h> int print_va_list (int n, va_list vl) { int i; printf("["); for(i=0; i<n; i++) printf (" '%s' ", va_arg (vl, char *)); printf("]\n"); return n; } int print_list (int n, ...) { va_list ap, *aq; int res; va_start (ap, n); va_copy (*aq, ap); res = print_va_list (n, ap); #ifndef BUG_START_END va_end (ap); #endif res = print_va_list (n, *aq); #ifndef BUG_COPY_END va_end (*aq); #endif #ifdef BUG_END_ARG res = va_arg (*aq,int); #endif #ifdef BUG_END_ARG2 res = va_arg (ap,int); #endif return res; } int main (int argc, char **argv) { return print_list(3, "alpha", "beta", "gamma"); }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |