brintos

brintos / llvm-project-archived public Read only

0
0
Text · 938 B · 5bf7240 Raw
43 lines · c
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-exception5 6//7//  nullblockisa.m8//  testObjects9//10//  Created by Blaine Garst on 9/24/08.11//12// CONFIG rdar://624452013 14 15 16#include <stdio.h>17#include <stdlib.h>18#include <Block_private.h>19 20 21void check(void (^b)(void)) {22    struct _custom {23        struct Block_layout layout;24        struct Block_byref *innerp;25    } *custom  = (struct _custom *)(void *)(b);26    //printf("block is at %p, size is %lx, inner is %p\n", (void *)b, Block_size(b), innerp);27    if (custom->innerp->isa != (void *)NULL) {28        printf("not a NULL __block isa\n");29        exit(1);30    }31    return;32}33        34int main(int argc, char *argv[]) {35 36   __block int i;37   38   check(^{ printf("%d\n", ++i); });39   printf("%s: success\n", argv[0]);40   return 0;41}42   43