Skip to content

Commit

Permalink
Using tail recursion for pp_each macros (gcc extensions not required)
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacc committed Jun 23, 2019
1 parent d6d06fd commit da33adc
Show file tree
Hide file tree
Showing 7 changed files with 549 additions and 268 deletions.
2 changes: 1 addition & 1 deletion buildandtest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ echo >> fff.h
ruby fakegen.rb >> fff.h
make clean
make all
build/fff_test_c
build/fff_test_c
build/fff_test_cpp --gtest_output=xml:build/test_results.xml
build/ui_test_ansic
build/ui_test_cpp --gtest_output=xml:build/example_results.xml
Expand Down
15 changes: 2 additions & 13 deletions fakegen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -583,26 +583,15 @@ def counting_macro_instance(type, vararg = :non_vararg, prefix = "")
end

def output_macro_counting_shortcuts
ppiter = PPIterators.new($MAX_ITER, use_gcc_extensions: true)
ppiter = PPIterators.new(use_gcc_extensions: false)
putd <<-MACRO_COUNTING
#ifndef PP_NARG
#{ppiter.narg_common}
#{ppiter.narg}
#endif
#{ppiter.embed_macros}
#{ppiter.narg_minus(1)}
#{ppiter.narg_minus(2)}
#ifndef PP_1PAR_EACH_IDX
#{ppiter.parameterised_each_with_index(1)}
#endif
#ifndef PP_2PAR_EACH_IDX
#{ppiter.parameterised_each_with_index(2)}
#endif
/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
#{counting_macro_instance(:VALUE)}
Expand Down
367 changes: 204 additions & 163 deletions fff.h

Large diffs are not rendered by default.

Loading

0 comments on commit da33adc

Please sign in to comment.