From b4fc012896d6c7ac8a5178ad88b977d6dfc96bee Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Sun, 15 Jul 2012 05:44:57 -0400 Subject: [PATCH] Mark rb_num_zerodiv as NORETURN Consider the following pattern. if (b == 0) rb_num_zerodiv(); c = a / b; This patch informs the compiler that rb_num_zerodiv doesn't return. Otherwise some compilers may conclude that the division a / b is always reachable, leading to misoptimization. --- include/ruby/intern.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 6895850..6cfeb15 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -512,7 +512,7 @@ VALUE rb_marshal_dump(VALUE, VALUE); VALUE rb_marshal_load(VALUE); void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE), VALUE (*loader)(VALUE, VALUE)); /* numeric.c */ -void rb_num_zerodiv(void); +NORETURN(void rb_num_zerodiv(void)); #define RB_NUM_COERCE_FUNCS_NEED_OPID 1 VALUE rb_num_coerce_bin(VALUE, VALUE, ID); VALUE rb_num_coerce_cmp(VALUE, VALUE, ID); -- 1.7.9.5