[AA] Rename CaptureInfo -> CaptureAnalysis (NFC) (#116842)
[llvm-project.git] / compiler-rt / test / BlocksRuntime / varargs.c
bloba0f56a579dff4b3160f0af90d04f581c724e792c
1 //
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
7 // CONFIG
9 #import <stdio.h>
10 #import <stdlib.h>
11 #import <string.h>
12 #import <stdarg.h>
15 int main (int argc, const char * argv[]) {
16 int (^sumn)(int n, ...) = ^(int n, ...){
17 int result = 0;
18 va_list numbers;
19 int i;
21 va_start(numbers, n);
22 for (i = 0 ; i < n ; i++) {
23 result += va_arg(numbers, int);
25 va_end(numbers);
27 return result;
29 int six = sumn(3, 1, 2, 3);
31 if ( six != 6 ) {
32 printf("%s: Expected 6 but got %d\n", argv[0], six);
33 exit(1);
36 printf("%s: success\n", argv[0]);
37 return 0;