brintos

brintos / llvm-project-archived public Read only

0
0
Text · 815 B · 21e810f Raw
31 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#include <stdio.h>7#include <Block.h>8 9// CONFIG10 11void callsomething(const char *format, int argument) {12}13 14void15dispatch_call_Block_with_release2(void *block)16{17        void (^b)(void) = (void (^)(void))block;18        b();19        Block_release(b);20}21 22int main(int argc, char *argv[]) {23     void (^b1)(void) = ^{ callsomething("argc is %d\n", argc); };24     void (^b2)(void) = ^{ callsomething("hellow world\n", 0); }; // global block now25 26     dispatch_call_Block_with_release2(Block_copy(b1));27     dispatch_call_Block_with_release2(Block_copy(b2));28     printf("%s: Success\n", argv[0]);29     return 0;30}31