tsan: fix deadlock detector lit test output
[blocksruntime.git] / test / BlocksRuntime / byrefcopy.c
blob513b63c2725daba27fc6384badc9eb7b7e9315d4
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 //
8 // byrefcopy.m
9 // testObjects
11 // Created by Blaine Garst on 5/13/08.
14 #include <stdio.h>
15 #include <Block.h>
16 #include <Block_private.h>
18 // CONFIG
20 void callVoidVoid(void (^closure)(void)) {
21 closure();
24 int main(int argc, char *argv[]) {
25 int __block i = 10;
27 void (^block)(void) = ^{ ++i; };
28 //printf("original (old style) is %s\n", _Block_dump_old(block));
29 //printf("original (new style) is %s\n", _Block_dump(block));
30 void (^blockcopy)(void) = Block_copy(block);
31 //printf("copy is %s\n", _Block_dump(blockcopy));
32 // use a copy & see that it updates i
33 callVoidVoid(block);
35 if (i != 11) {
36 printf("*** %s didn't update i\n", argv[0]);
37 return 1;
39 printf("%s: success\n", argv[0]);
40 return 0;