codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

Remove macros that call other functions with 2 parameters and the order doesn't change. #103

Closed Sebanisu closed 3 years ago

Sebanisu commented 3 years ago

find_replace_macro.py was originally meant to replace all the macros it found. Though this did over 1000 replacements it broke stuff. So I altered it to find and remove one macro at a time, log the changes and print what it removed. So I could copy and paste what changed into git commit. And run tests between each removal.

I currently am targeting macros that fit this pattern:

#define C2fromC1(x,y)               jtC2fromC1(jt,(x),(y))

Each macro that has two arguments that are passed to another function. The parameters order doesn't change. So in this instance it takes C2fromC1( and replaces it with jtC2fromC1(jt,.

removal_log.md is a markdown table showing what was changed so far.

Sebanisu commented 3 years ago

Hmm the CI failed to pull the source from github. I wonder if I'm over using the CI.

Sebanisu commented 3 years ago

These extra tests failed multiple times after commit remove #define bindd https://github.com/codereport/jsource/pull/103/commits/593180e2b0585647262bd462fdbbf8e42d29057a So right now i'm gonna roll that back I'll add an exclude list to the py file with bindd so it doesn't get removed. Maybe it can be done manually later.

97% tests passed, 14 tests failed out of 401
--
  |  
  | Total Test time (real) =  63.54 sec
  |  
  | The following tests FAILED:
  | 47 - hare_g100s (Failed)
  | 163 - hare_g410 (Failed)
  | 164 - hare_g410a (Failed)
  | 185 - hare_g430a2 (Failed)
  | 254 - hare_gf (Failed)
  | 255 - hare_gfor (Failed)
  | 288 - hare_gnan (Failed)
  | 303 - hare_gpoly (Failed)
  | 324 - hare_gsp (Failed)
  | 346 - hare_gsp410 (Failed)
  | 348 - hare_gsp420 (Failed)
  | 382 - hare_gxco1 (Failed)
  | 396 - tortoise_g600ip (Failed)
  | 401 - tortoise_gss (Failed)
Sebanisu commented 3 years ago

Previously I spent tuesday running the python script and watching the CI to see if it failed.

Today I altered my python script to hopefully automatically run the a regex replace, build with ninja and run tests. If tests pass commit the change. Else it resets and add's the name of the macro an exclude list and commit's that. This loops till it can't find a macro that fits the pattern. And this no longer will push any commits it all happens locally on my machine.

I hope this means these few macros will be done.

Sebanisu commented 3 years ago

Well my script did some work today it had 144 commits. These were removing macros or excluding ones that need manual removal. Though after I pushed them. I did a bad merge from main. lol So I'm gonna try to put off merging main till the script is done running. I managed to undo the bad merge using git rebase -i <commit_id>. I even tried out squashing things. Though it appears I didn't discard the existing commits. So next squash I'll need to do git push -f origin eval_macros_that_call_other_functions. At least I think that works.

Sebanisu commented 3 years ago

I have many merge conflicts. And I'm struggling to get rid of them all. So since my python script can redo the changes. I can wait till the stream is done and run the python script and do a fresh pull request tomorrow.