diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-03-03 10:25:25 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-03-03 10:25:25 +0000 |
commit | 93d89c2b5e8497365be152fb53cb6cd4c5764d34 (patch) | |
tree | 0de8d05bbd0eeaeb5e4b85395f8dd576984b6a9e /cil/test/small1/vararg1.c | |
parent | 891377ce1962cdb31357d6580d6546ec22df2b4f (diff) | |
download | compcert-kvx-93d89c2b5e8497365be152fb53cb6cd4c5764d34.tar.gz compcert-kvx-93d89c2b5e8497365be152fb53cb6cd4c5764d34.zip |
Getting rid of CIL
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1270 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/test/small1/vararg1.c')
-rw-r--r-- | cil/test/small1/vararg1.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/cil/test/small1/vararg1.c b/cil/test/small1/vararg1.c deleted file mode 100644 index cc710a7b..00000000 --- a/cil/test/small1/vararg1.c +++ /dev/null @@ -1,47 +0,0 @@ - -/* VA.C: The program below illustrates passing a variable - * number of arguments using the following macros: - * va_start va_arg va_end - * va_list va_dcl (UNIX only) - */ - -#include <stdio.h> -#include <stdarg.h> -int average( int first, ... ); -union vararg_average { - int ints; /* We only pass ints to this one */ -}; - -#include "testharness.h" - -int main( void ) -{ - /* Call with 3 integers (-1 is used as terminator). */ - if(average( 2, 3, 4, -1 ) != 3) E(1); - if(average( 5, 7, 9, 11, 13, -1 ) != 9) E(2); - if(average( -1 ) != 0) E(3); - - SUCCESS; -} - - - -/* Returns the average of a variable list of integers. */ -int average( int first, ... ) -{ - int count = 0, sum = 0, i = first; - va_list marker; - - va_start( marker, first ); /* Initialize variable arguments. */ - while( i != -1 ) - { - sum += i; - count++; - i = va_arg( marker, int); - } - va_end( marker ); /* Reset variable arguments. */ - return( sum ? (sum / count) : 0 ); -} - -// Put this intentionally at the end -#pragma ccuredvararg("average", sizeof(union vararg_average)) |