tsan: fix deadlock detector lit test output
[blocksruntime.git] / test / BlocksRuntime / varargs.c
blob01affc76e68c542c06ee3ebce2bf3cc882f504c2
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
7 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
8 // CONFIG
10 #import <stdio.h>
11 #import <stdlib.h>
12 #import <string.h>
13 #import <stdarg.h>
16 int main (int argc, const char * argv[]) {
17 int (^sumn)(int n, ...) = ^(int n, ...){
18 int result = 0;
19 va_list numbers;
20 int i;
22 va_start(numbers, n);
23 for (i = 0 ; i < n ; i++) {
24 result += va_arg(numbers, int);
26 va_end(numbers);
28 return result;
30 int six = sumn(3, 1, 2, 3);
32 if ( six != 6 ) {
33 printf("%s: Expected 6 but got %d\n", argv[0], six);
34 exit(1);
37 printf("%s: success\n", argv[0]);
38 return 0;