general update, updated cimport so it parses struct definitions from imported headers, improved the error reporting, added ifdef and ifndef, added proper support for extern variadic functions, added some new sections and pages to the doc tool and added --check to only check the program corectness and run compile time defs without producing a binary
This commit is contained in:
20
tests/variadic_extern.c
Normal file
20
tests/variadic_extern.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Sums variadic long args until sentinel -1 is seen. */
|
||||
long va_sum_sentinel(long first, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, first);
|
||||
long total = first;
|
||||
while (1) {
|
||||
long v = va_arg(ap, long);
|
||||
if (v == -1) break;
|
||||
total += v;
|
||||
}
|
||||
va_end(ap);
|
||||
return total;
|
||||
}
|
||||
|
||||
/* Non-variadic helper for comparison. */
|
||||
long add_two(long a, long b) {
|
||||
return a + b;
|
||||
}
|
||||
Reference in New Issue
Block a user