Skip to content

Commit

Permalink
Fix unreachable return statements. (#109)
Browse files Browse the repository at this point in the history
* Fixed some return statements that were generated unconditionally,
  leading to unreachable return statements in some cases.
* Regenerated fff.h
  • Loading branch information
damaki authored May 19, 2023
1 parent 11ab05b commit a9cb716
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 64 deletions.
6 changes: 3 additions & 3 deletions fakegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def output_function_body(arg_count, has_varargs, is_value_function)
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
putd_backslash "va_end(ap);" unless not is_value_function
putd_backslash "return ret;" unless not is_value_function
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);"
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);" unless is_value_function
putd_backslash "va_end(ap);" unless is_value_function
}
putd_backslash "}"
Expand Down Expand Up @@ -497,7 +497,7 @@ def output_function_body(arg_count, has_varargs, is_value_function)
putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)});" unless not is_value_function
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
putd_backslash "return ret;" unless not is_value_function
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)});"
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)});" unless is_value_function
}
putd_backslash "}"
}
Expand All @@ -507,7 +507,7 @@ def output_function_body(arg_count, has_varargs, is_value_function)
putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});" unless not is_value_function
putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
putd_backslash "return ret;" unless not is_value_function
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});"
putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});" unless is_value_function
}
putd_backslash "}"
end
Expand Down
Loading

0 comments on commit a9cb716

Please sign in to comment.