リスト36 リスト37 リスト38 リスト39


〔リスト36〕ANSI C準拠のコードの例(test68.c)
	#include <stdio.h>
	void abend_proc ();
	int main(void)
	{
	 abend_proc();
	 return;
	}
	void abend_proc ()
	{
	 printf("____abend_____     kita----");
	 exit(1);
	}
		
	〔リスト38〕noreturn属性を使用する例(test69.c)
	#include <stdio.h>
	void abend_proc () __attribute__ ((noreturn));
	int main(void)
	{
	 abend_proc();
	 return;
	}
	void abend_proc ()
	{
	 printf("____abend_____     kita----");
	 exit(1);
	}


〔リスト37〕test68.cから生成されたアセンブラ(test68.s)
	 .file "test68.c"
	 .version "01.01"
	gcc2_compiled.:
	.section .rodata
	.LC0:
	 .string "____abend_____     kita----"
	.text
	 .align 4
	.globl abend_proc
	 .type  abend_proc,@function
	abend_proc:
	 pushl %ebp
	 movl %esp,%ebp
	 subl $8,%esp
	 addl $-12,%esp
	 pushl $.LC0
	 call printf
	 addl $-12,%esp
	 pushl $1
	 call exit
	.Lfe1:
	 .size  abend_proc,.Lfe1-abend_proc
	 .align 4
	.globl main
	 .type  main,@function
	main:
	 pushl %ebp
	 movl %esp,%ebp
	 subl $8,%esp
	 call abend_proc
	 movl %ebp,%esp
	 popl %ebp
	 ret
	.Lfe2:
	 .size  main,.Lfe2-main
	 .ident "GCC: (GNU) 2.95.3 20010315 (release)"


〔リスト38〕noreturn属性を使用する例(test69.c)
	#include <stdio.h>
	void abend_proc () __attribute__ ((noreturn));
	int main(void)
	{
	 abend_proc();
	 return;
	}
	void abend_proc ()
	{
	 printf("____abend_____     kita----");
	 exit(1);
	}


〔リスト39〕test69.cから生成されたアセンブラ(test69.s)
	 .file "test69.c"
	 .version "01.01"
	gcc2_compiled.:
	.section .rodata
	.LC0:
	 .string "____abend_____     kita----"
	.text
	 .align 4
	.globl abend_proc
	 .type  abend_proc,@function
	abend_proc:
	 pushl %ebp
	 movl %esp,%ebp
	 subl $8,%esp
	 addl $-12,%esp
	 pushl $.LC0
	 call printf
	 addl $-12,%esp
	 pushl $1
	 call exit
	.Lfe1:
	 .size  abend_proc,.Lfe1-abend_proc
	 .align 4
	.globl main
	 .type  main,@function
	main:
	 pushl %ebp
	 movl %esp,%ebp
	 subl $8,%esp
	 call abend_proc
	.Lfe2:
	 .size  main,.Lfe2-main
	 .ident "GCC: (GNU) 2.95.3 20010315 (release)"