#import<Foundation/Foundation.h>#defineOnexit\__strongvoid(^block) () __attribute__ ((Cleanup (cleanup), unused)) = ^__attribute__ ((constructor))voidExecutebefore_main () {printf ("executebefore_main\n");} __attribute__ ((destructor))voidExecuteafter_main () {printf ("executeafter_main\n");}voidFunctiondeprecatedandobsoletewarninganderror () __attribute__ (Availability (macosx,introduced=10.4, deprecated=10.10, obsoleted=10.13)));voidFunctiondeprecatedandobsoletewarninganderror (void){ }intreturnvaluenotunusedwarning () __attribute__ ((Warn_unused_result));intreturnvaluenotunusedwarning () {return 1;}voidCleanup (__strongvoid(^*block) ()){ (*block) ();}intMainintargcConst Char*argv[]) {@autoreleasepool {printf ("Hello, world!\n."); Functiondeprecatedandobsoletewarninganderror (); Returnvaluenotunusedwarning (); onexit{printf ("onexit\n"); }; } return 0;}
Objective-c Source Code __attribute__