From 4abc9e3936266bfba433c3dcc3b1f8ce5dfb489a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Jul 2023 10:12:38 -0700 Subject: [PATCH] Fix 2005/toledo for some versions of clang In some versions of clang there is an additional defect where it only allows main() to have 0, 2 or 3 args. A new function was added which is what used to be main() that main() now calls. The alt versions have also had this fix applied. --- 2005/toledo/toledo.c | 11 ++++++----- 2005/toledo/toledo2.c | 9 +++++---- 2005/toledo/toledo3.c | 9 +++++---- thanks-for-fixes.md | 8 ++++++++ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/2005/toledo/toledo.c b/2005/toledo/toledo.c index 1557b9af6..8c5d42a87 100644 --- a/2005/toledo/toledo.c +++ b/2005/toledo/toledo.c @@ -2,7 +2,7 @@ #define F getchar()) #define H(z)*n++=z; #include - #define v main(0,0,0 + #define v pain(0,0,0 #define Z while( #define _ if( #define o(d) (u[l]=0,l[d]=6^e,q=1e4>v,0),l[d]=0,u[l]=e^6,q) @@ -14,19 +14,20 @@ a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\ 10)|r)*99+(j==1?90x)*(9*O[28+i]-288))+O[r+28\ ]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\ =u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\ -*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\ +*(u==98|x==98)+(20==d)*64*x; a-=k>f?pain(a,f+1\ ,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\ p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\ )){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \ L-aGK[_`fFDZXEYR" "L\t####" "##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb" "ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y, -c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,C fa, -C Na,C ka){G f=fa; G N=Na; G k=ka; +c,h,e,S,*s,l[149]; jmp_buf z; G main(G L, C fa, C Na){ +return pain(L, fa, Na, kk);} G pain(G L,C fa, +C Na, C ka){G f=fa; G N=Na; G k=ka; G u=99,p,q,r,j,i,x ,t, a, b,d,M=-1e9 ; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e; _!-- q){ _!l[p=e?u-10:u+10]){ I(p,)_ e?u>80 & !l[p diff --git a/2005/toledo/toledo2.c b/2005/toledo/toledo2.c index cf44d2c02..b5a881bc0 100644 --- a/2005/toledo/toledo2.c +++ b/2005/toledo/toledo2.c @@ -2,7 +2,7 @@ #define F getchar()) #define H(z)*n++=z; #include - #define v main(0,0,0 + #define v pain(0,0,0 #define Z while( #define _ if( #define o(d)(S=63,l[d]=6^e,q=1e4>v,u[l]=0),l[d]=0,u[l]=e^6,S=b,q) @@ -14,18 +14,19 @@ a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\ 10)|r)*99+(j==1?90x)*(9*O[28+i]-288))+O[r+28\ ]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\ =u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\ -*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\ +*(u==98|x==98)+(20==d)*64*x; a-=k>f?pain(a,f+1\ ,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\ p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\ )){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \ L-aGK[_`fFDZXEYR" "L\t####" "##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb" "ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y, -c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,C fa, +c,h,e,S,*s,l[149]; jmp_buf z; G main(G L, C fa, C Na){ +return pain(L, fa, Na, kk); } G pain(G L,C fa, C Na,C ka){ G f=fa; G N=Na; G k=ka; G u=99,p,q,r,j,i,x ,t,a,b=S,d,M=-1e9 ; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e; diff --git a/2005/toledo/toledo3.c b/2005/toledo/toledo3.c index 72e2d7a76..ad13523c4 100644 --- a/2005/toledo/toledo3.c +++ b/2005/toledo/toledo3.c @@ -2,7 +2,7 @@ #define F getchar()) #define H(z)*n++=z; #include - #define v main(0,0,0 + #define v pain(0,0,0 #define Z while( #define _ if( #define o(d)(S=63,u[l]=0,l[d]=6^e,q=1e4>v,0),l[d]=0,u[l]=e^6,S=b,q) @@ -14,18 +14,19 @@ a=((j^e)!=1?6!=(j^e)?O[32+x/10]-O[u/10+32]-q:(S|=6!=j?8\ 10)|r)*99+(j==1?90x)*(9*O[28+i]-288))+O[r+28\ ]*9-288+O[x%10+33]-f-O[33+u%10]; x[l]=i; S|=(21=\ =u|21==x)*2+(u==28|28==x)*4+(91==u|x==91)*16+32\ -*(u==98|x==98)+(20==d)*64*x; a-=k>f?main(a,f+1\ +*(u==98|x==98)+(20==d)*64*x; a-=k>f?pain(a,f+1\ ,M,k):0; _ i==c&u==h&!f&N&a>-1e4&x==y)longjm\ p(z,1); S=b; _!N|f&&(a>M||!f&a==M&&1&rand()\ )){ _!f){ _ k){ c=i; h=u; y=x; } } else _ \ L-aGK[_`fFDZXEYR" "L\t####" "##B#A#@#G#F#E#D#K\t\3Zlv#tjm" "\3J#tjm\3Pwb" "ofnbwf\3Joofdbo\3)&`&`.&`&`" "#+&g*\t"; G y, -c,h,e,S,*s,l[149]; jmp_buf z ; G main(G L,C fa, +c,h,e,S,*s,l[149]; jmp_buf z; G main(G L, C fa, C Na) { +return pain(L, fa, Na, kk); } G pain(G L,C fa, C Na,C ka){ G f=fa; G N=Na; G k=ka; G u=99,p,q,r,j,i,x ,t,a,b=S,d,M=-1e9 ; char *n; if( *l){ e=~e; Z u >21){ q= l[--u]^e; diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 57f3df3ae..5ed214dcb 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1217,6 +1217,14 @@ Cody also added the alt code which does scan for https. Futile, maybe, based on how https is set up, in which case just enjoy it for what it was. But there might be some command line that will let it work that way. +## [2005/toledo](2005/toledo/toledo.c) ([README.md](2005/toledo/README.md)) + +Cody fixed this to compile with some versions of clang which have an additional +defect where `main()` can only have 0, 2 or 3 args (it was 4). It now calls +another function that takes 4 args and which is what used to be `main()`. + +The alternate versions were also fixed. + ## [2006/birken](2006/birken/birken.c) ([README.md](2006/birken/README.md]))