Skip to content

Commit

Permalink
Merge pull request #27 from usr42/issue26
Browse files Browse the repository at this point in the history
Fix issue 26: Use void as parameter when no parameter exists
  • Loading branch information
Mike Long committed Feb 3, 2017
2 parents 963ec65 + 88e6ac3 commit 74c07a8
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 90 deletions.
7 changes: 4 additions & 3 deletions fakegen.rb
Expand Up @@ -160,7 +160,7 @@ def define_extern_c_helper
def define_reset_fake_helper
putd ""
putd "#define DEFINE_RESET_FUNCTION(FUNCNAME) \\"
putd " void FUNCNAME##_reset(){ \\"
putd " void FUNCNAME##_reset(void){ \\"
putd " memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \\"
putd " FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN;\\"
putd " }"
Expand Down Expand Up @@ -266,11 +266,12 @@ def output_variables(arg_count, has_varargs, is_value_function)
output_custom_function_array(arg_count, has_varargs, is_value_function)
}
putd "extern FUNCNAME##_Fake FUNCNAME##_fake;\\"
putd "void FUNCNAME##_reset(); \\"
putd "void FUNCNAME##_reset(void); \\"
end

#example: ARG0_TYPE arg0, ARG1_TYPE arg1
def arg_val_list(args_count)
return "void" if (args_count == 0)
arguments = []
args_count.times { |i| arguments << "ARG#{i}_TYPE arg#{i}" }
arguments.join(", ")
Expand Down Expand Up @@ -348,7 +349,7 @@ def output_function_body(arg_count, has_varargs, is_value_function)
end

def output_reset_function(arg_count, is_value_function)
putd "void FUNCNAME##_reset(){ \\"
putd "void FUNCNAME##_reset(void){ \\"
putd " memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \\"
putd " FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN;\\"
putd "} \\"
Expand Down

0 comments on commit 74c07a8

Please sign in to comment.