diff --git a/1986/marshall/Makefile b/1986/marshall/Makefile
index 36ae488f9..87e398584 100644
--- a/1986/marshall/Makefile
+++ b/1986/marshall/Makefile
@@ -44,7 +44,7 @@ CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
-Wno-deprecated-non-prototype -Wno-pointer-to-int-cast -Wno-return-type \
-Wno-strict-prototypes -Wno-uninitialized -Wno-unused-parameter \
-Wno-address -Wno-builtin-declaration-mismatch -Wno-sequence-point \
- -Wno-unknown-warning-option
+ -Wno-unknown-warning-option -Wno-int-to-pointer-cast
# Common C compiler warning flags
#
diff --git a/1986/marshall/marshall.alt.c b/1986/marshall/marshall.alt.c
index b7f685340..5677566cb 100644
--- a/1986/marshall/marshall.alt.c
+++ b/1986/marshall/marshall.alt.c
@@ -10,5 +10,5 @@ x ;if (P( ! i ) | cc[ ! j ]
& P(j )>2 ? j : i ){* argv[i++ +!-i]
; for (i= 0;; i++ );
_exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]);printf("%d",P(""));}}
- P ( a ) char a ; { a ; while( a > " B "
+ P ( a ) char a ; { a ; while((char *)a > " B "
/* - by E ricM arsh all- */); }
diff --git a/thanks-for-help.html b/thanks-for-help.html
index 6db2bbf14..8a2fec748 100644
--- a/thanks-for-help.html
+++ b/thanks-for-help.html
@@ -494,6 +494,27 @@ args to main() and the third arg was an
href="1986/marshall/compilers.html">compilers.html file to see how
odd this problem was and what Cody did to fix it, if nothing else but
for entertainment!
Also, after all warnings but one that could not be silenced were
+disabled, Cody changed the alt code (which was not the same as the
+original - see above for details or try make diff_orig_alt
+in the directory) slightly so that it was possible to silence it. In
+particular:
P ( a ) char a ; { a ; while( a > " B "which gave:
+marshall.alt.c:13:55: warning: ordered comparison between pointer and integer ('char' and 'char *')
+ P ( a ) char a ; { a ; while( a > " B "
+ ~ ^ ~~~~~~~~
+1 warning generated.
+was changed to:
+ P ( a ) char a ; { a ; while((char *)a > " B "which gave:
+marshall.alt.c:13:48: warning: cast to 'char *' from smaller integer type 'char' [-Wint-to-pointer-cast]
+ P ( a ) char a ; { a ; while((char *)a > " B "
+ ^~~~~~~~~
+1 warning generated.
+
+which can be disabled. It results in the same behaviour but this way +no warnings are produced.
-traditional-cpp.
If you’d like to see the difference between the version that requires
-traditional-cpp and the fixed version, try:
cd 1986/wall ; make diff_orig_progcd 1986/wall ; make diff_orig_progSome of the changes required:
Instead of using the c_, defined as
@@ -683,49 +705,49 @@ well, however.
-traditional-cpp (which clang does not support). It needed that
option in modern systems because of two things it did:
-#define a(x)get/***/x/***/id())
-
-/* ... */
-
-p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
-
-/* ... */
-
-case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;#define a(x)get/***/x/***/id())
+
+/* ... */
+
+p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);
+
+/* ... */
+
+case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;This macro, a, formed the functions (the names)
getuid() and getgid(), but this no longer
works. The code still uses the macro a to form the names
but it’s done differently, using the C token paste operator
##. It’s done like thus:
--- i/1988/dale/dale.c
-+++ w/1988/dale/dale.c
-@@ -9,18 +9,18 @@
- #define L if
- #define I goto
- #define l 1
- #define f write
- #define J else
--#define a(x)get/***/x/***/id())
-+#define a(x)get##x##id())--- i/1988/dale/dale.c
++++ w/1988/dale/dale.c
+@@ -9,18 +9,18 @@
+ #define L if
+ #define I goto
+ #define l 1
+ #define f write
+ #define J else
+-#define a(x)get/***/x/***/id())
++#define a(x)get##x##id())The second is that
-for/*/(;;);/*/k()){O/*/*/c);for/*/(;;);/*/k()){O/*/*/c);cannot form fork()) in modern C compilers. Since it was
not done through a macro it was simply changed to be
fork(), rather than adding a new macro.
The other problem that could not be resolved by the
-traditional-cpp was that modern compilers do not allow
directives like:
#define _ define
-#_ P char
-#_ p int
-#_ O close(
-/* ... */#define _ define
+#_ P char
+#_ p int
+#_ O close(
+/* ... */so Cody changed the lines to be in the form of:
-#define P char
-#define p int
-#define O close(
-/* ... */#define P char
+#define p int
+#define O close(
+/* ... */However, to keep the entry as close to as possible in look, Cody kept
the _ macro in place it’s just no longer used.
See the index.html file for details on the original code, provided as @@ -815,22 +837,22 @@ was also fixed in fubar.sh.
A strange problem occurred where if one made modifications to the C file it might end up failing to work even after changing it back. This was resolved by:
---- i/1989/fubar/fubar.sh
-+++ w/1989/fubar/fubar.sh
-@@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
- exit 1
- fi
-
- # run/compile it
- rm -f ouroboros.c x1 x
--ex - <<EOF
--r fubar.c
-+ex fubar.c <<EOF
- 8,9j
- w ouroboros.c
- EOF
- chmod +x ouroboros.c--- i/1989/fubar/fubar.sh
++++ w/1989/fubar/fubar.sh
+@@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
+ exit 1
+ fi
+
+ # run/compile it
+ rm -f ouroboros.c x1 x
+-ex - <<EOF
+-r fubar.c
++ex fubar.c <<EOF
+ 8,9j
+ w ouroboros.c
+ EOF
+ chmod +x ouroboros.cCody also ‘modernised’ the script to use bash and fixed
for ShellCheck. The if [ .. ] was changed in the C code as
well as the script.
Cody fixed this to work with modern compilers. Modern compilers do not allow code like:
-#define D define
-#define a include
-
-#D foo bar
-#a <stdio.h>#define D define
+#define a include
+
+#D foo bar
+#a <stdio.h>He notes that there is a way to get it (or something close to it) to work. Do you know how?
Cody also provided the try.sh script @@ -910,8 +932,8 @@ href="1989/robison/robison.c">1989/robison (index.html)
Yusuke Endoh fixed this to compile under modern systems. To see the changes made, try:
-cd 1989/robison ; make diff_orig_progcd 1989/robison ; make diff_orig_prog(It adds the C token pasting operator ## instead of
/**/.)
Cody also added the try.sh @@ -1071,11 +1093,11 @@ href="1990/dg/index.html%5D">index.html)
Cody fixed this for modern systems. There were two problems to be resolved.
One can no longer do:
-#define d define
-
-#d b12(x) 12 x
-
-/* etc. */#define d define
+
+#d b12(x) 12 x
+
+/* etc. */so the use of #d is now instead #define
(the macro was originally deleted but later Cody added it back to make
it more like the original).
fibonacci.c bug he ended up changing it anyway).
BTW: why can’t the fix:
-if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;be changed to just test the value of A when
a is argv and A is argc?
Cody also changed the code to use fgets(3).
char*s to
char s[]):
!.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo
and then the call to system() had to be changed to:
system(q-69);system(q-69);An important point is that the placement of this string in the
s array does matter. This is because of the code:
*o=fopen(q-3,"w");*o=fopen(q-3,"w");which means the file name that translates to a.c has to
be at the end of the string. Thus the end of the string actually looks
like:
fgets(3). As can be seen above it’s not as simple as
changing gets(3) to fgets(3). This was more
magic characters that had to be updated and some added. The C code:
-atoi(gets(b))atoi(gets(b))is in the string:
bupj)hfut)c**
which was changed to be (in C):
-atoi(fgets(b,99,stdin))atoi(fgets(b,99,stdin))which in the program is:
bupj)ghfut)c-::-tuejo**
That’s fine and well but since the code does not include
@@ -1316,16 +1338,16 @@ updated again and the system(q-86) had to be changed to
correct code, the generated code was changed to return 1;
rather than just return;. Thus in full the string
became:
char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<n\
-bjo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso!2<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<a\
-N2!Q\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4\
-HC%TQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQU\
-aP1HR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3\
-Q=>n\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qq\
-vut)aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%\
-LN1UP1D12JIQUaP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!.Xop.\
-fssps!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.Xop.jnqmjdju.jou!.jodmvef!tuejp/i!\
-b/d";char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<n\
+bjo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso!2<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<a\
+N2!Q\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4\
+HC%TQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQU\
+aP1HR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3\
+Q=>n\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qq\
+vut)aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%\
+LN1UP1D12JIQUaP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!.Xop.\
+fssps!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.Xop.jnqmjdju.jou!.jodmvef!tuejp/i!\
+b/d";and it now is system(q-87);.
It is hoped that this is the last time the string has to be updated to work with all versions of clang but if not the above is how it @@ -1424,19 +1446,19 @@ added. Then it was noticed that the problem is that it was never fixed in any of the files, not the code or the documentation, and thus was entirely incorrect code. A fun fact is that one can do:
-W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);but one CANNOT do:
-W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
-if (W==NULL)exit(1);W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
+if (W==NULL)exit(1);because adwc.c will be empty! The difference is it is on
a newline, the check. This is an example of how a simple change in code
can break it and this is also true of another change as further
below.
Cody also restored a slightly more obscure line of code that had been changed:
-- putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
-+ putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);- putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
++ putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);though it’s questionable how much more (if at all) obscure that is :-)
Cody also changed the location that it used gets() to be
@@ -1463,7 +1485,7 @@ operator or a &&) as this, as might be expected
from the above, caused compilation errors with another generated file
(adwc.c)! Thus after the gets(3) call in the
line that looks like:
while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); }while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); }one must keep the Y[strlen(Y)-1]='\0'; part and keep it
there.
These fixes are complex changes due to the way the program and @@ -1718,8 +1740,8 @@ this so that it will work with modern systems. Yusuke provided some fixes of the X code and Cody fixed the C pre-processor directives so that it would compile. It used to be that you could get away with code like:
-G int i,j
-K caseG int i,j
+K caseand expect G; to equate to int i, j;
(though it’s now a long) and K to mean case
but that’s no longer the case so the offending lines had
@@ -2311,7 +2333,7 @@ point since the author stated it has no while,
do...while, for, if/else,
switch, ?: Cody removed the if statement by
doing:
((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1)));((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1)));Cody also added the try.sh script to help users try the commands that we recommended as well as some added by him.
@@ -2343,7 +2365,7 @@ because it’s almost certain that some files will not exist, it would dereference a NULL pointer and very likely crash or halt and catch fire :-), preventing the entry from working. Notice howH is a
funny macro defined as:
-%:define H(x) <st%:%:x##.h>%:define H(x) <st%:%:x##.h>and yet the FILE * can be called H! This
might or might not make sense to you but if it doesn’t can you figure
out why?
To get this to compile with clang, main() had to change
from:
main (char *ck, char **k)main (char *ck, char **k)to:
-main (int cka, char **k) { char *ck = (char *)cka; /* ... */ }main (int cka, char **k) { char *ck = (char *)cka; /* ... */ }The following change was also made to be more portable, in case the
constants PROT_READ and/or PROT_WRITE are not
standardised or some platform does not follow it:
NOTE: there might be educational value to see the progress of this
fix; if you wish to see, try the following commands from the
2001/anonymous directory:
git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c
-git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c
-git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c
-git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
-git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..2159caec4677e0f25ad704a74e04c8196fd6c343 anonymous.c
-git diff 2159caec4677e0f25ad704a74e04c8196fd6c343..4bc03de321612869aebf855850c6500df95cb6ef anonymous.cgit diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c
+git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c
+git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c
+git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
+git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..2159caec4677e0f25ad704a74e04c8196fd6c343 anonymous.c
+git diff 2159caec4677e0f25ad704a74e04c8196fd6c343..4bc03de321612869aebf855850c6500df95cb6ef anonymous.cFinally to see from start to finish:
-git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.cgit diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.cor to not use git:
make diff_orig_progmake diff_orig_progCody also added a program like anonymous.ten.c Ten Green
@@ -2722,12 +2744,12 @@ href="2001/coupard/index.html%5D">index.html)
main() to make it more portable.
Cody fixed this to compile with clang in Linux. The problem was C99 does not support implicit int:
-coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
-void e(n,h){
- ^
-coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
-void e(n,h){
- ^coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
+void e(n,h){
+ ^
+coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
+void e(n,h){
+ ^and for some reason it was being reported as an error. This was not
really worth a thanks per se but it was originally done by adding
int. The better solution is to disable the warning which is
@@ -2943,20 +2965,20 @@ href="2004/jdalbec/index.html">index.html)
with clang). The problem was the cpp being unable to parse the generated
code (see the index.html for details) and this ended up with a number of
errors like:
jdalbec.c:64:5: error: stray '##' in program
- 64 | B N##B (I) ; \
- | ^~
-
-
-..
-
-jdalbec.c:65:5: error: stray '##' in program
- 65 | V F##B (B) ; \
- | ^~
-jdalbec.c:65:5: error: expected ';' before 'B'
- 65 | V F##B (B) ; \
- | ^ ~
- | ;jdalbec.c:64:5: error: stray '##' in program
+ 64 | B N##B (I) ; \
+ | ^~
+
+
+..
+
+jdalbec.c:65:5: error: stray '##' in program
+ 65 | V F##B (B) ; \
+ | ^~
+jdalbec.c:65:5: error: expected ';' before 'B'
+ 65 | V F##B (B) ; \
+ | ^ ~
+ | ;and various other problems.
Cody also added alt code which allows one to control how many numbers after the @@ -3016,41 +3038,41 @@ href="2004/vik2/index.html">index.html)
Cody fixed this to compile in Linux. Although it compiled cleanly in macOS (and BSD?) the code failed to compile at all in Linux due to:
-cc -E vik2_1.c > vik2_2.c
-In file included from vik2.c:945,
- from vik2.c:959,
- from vik2.c:972,
- from vik2.c:1025:
-vik2.c:383:8: error: no macro name given in #ifdef directive
- 383 | O \
- | ^
-In file included from vik2.c:946:
-vik2.c:383:8: error: no macro name given in #ifdef directive
- 383 | O \
- | ^
-In file included from vik2.c:947:
-vik2.c:383:8: error: no macro name given in #ifdef directive
- 383 | O \
- | ^
-In file included from vik2.c:948:
-vik2.c:383:8: error: no macro name given in #ifdef directive
- 383 | O \
- | ^
-
-...
-
-In file included from vik2.c:182:
-
-vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
- 992 | I
- | ^
-vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-vik2.c:1500:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-vik2.c:1501:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-vik2.c:1504:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
-make: *** [Makefile:133: vik2] Error 1cc -E vik2_1.c > vik2_2.c
+In file included from vik2.c:945,
+ from vik2.c:959,
+ from vik2.c:972,
+ from vik2.c:1025:
+vik2.c:383:8: error: no macro name given in #ifdef directive
+ 383 | O \
+ | ^
+In file included from vik2.c:946:
+vik2.c:383:8: error: no macro name given in #ifdef directive
+ 383 | O \
+ | ^
+In file included from vik2.c:947:
+vik2.c:383:8: error: no macro name given in #ifdef directive
+ 383 | O \
+ | ^
+In file included from vik2.c:948:
+vik2.c:383:8: error: no macro name given in #ifdef directive
+ 383 | O \
+ | ^
+
+...
+
+In file included from vik2.c:182:
+
+vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+ 992 | I
+ | ^
+vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+vik2.c:1500:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+vik2.c:1501:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+vik2.c:1504:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
+make: *** [Makefile:133: vik2] Error 1Unfortunately the fix required heavy modification to the original
file (see below) and also inclusion of what used to be generated by the
Makefile but now it at least works for
@@ -3121,7 +3143,7 @@ that the long*E is now int*E. This solves a
specific problem for Linux (32-bit, 64-bit) and macOS (arm64).
To get the self-test feature to work it was required to remove from the code:
-O-b-f-u -s-c-a-t-e;O-b-f-u -s-c-a-t-e;as it caused a compilation error in some of the generated code but served no purpose, didn’t affect the output of the puzzle and since the ‘string’ is already in the code there is no problem omitting it.
@@ -3133,20 +3155,20 @@ change might also not have been necessary if using different flags tocc but this is less portable and caused other problems.
This was a complicated fix as it’s in the comments but in a funny way;
the final result to get the test feature to work is:
-;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
-/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
-;;;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
+/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
+;;changed from:
-;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
-/*c.c;cc/c.c /-c*/;;;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
+/*c.c;cc/c.c /-c*/;;or as a diff:
--(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
--/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l
--[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+
-+(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
-+/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
-+;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+-(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
+-/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l
+-[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+
++(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
++/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
++;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+Cody also added the try.sh script which also lets one see the beauty of the entry without having to use vi(m), should they be afraid of getting stuck in it (and for ease of @@ -3176,12 +3198,12 @@ href="2005/mikeash/index.html">index.html)
Cody fixed this to work in Linux. The problem was
an unknown escape sequence, \N, which caused a funny
compiler error:
};n b[2048];int i
-mikeash.c: In function 'R':
-mikeash.c:7:1: error: '\N' not followed by '{'
- 7 | ;C!='\n';A()
- | ^
-mikeash.c:7:1: error: incomplete universal character name \Ne};n b[2048];int i
+mikeash.c: In function 'R':
+mikeash.c:7:1: error: '\N' not followed by '{'
+ 7 | ;C!='\n';A()
+ | ^
+mikeash.c:7:1: error: incomplete universal character name \NeThe problem was that in the string above there was a
\Newline but this is invalid C. This was changed to be
\nNewline and then, because the code is supposed to output
@@ -3884,14 +3906,14 @@ really just a decompressor to generate the real source of the program.
So the source of the entry has to be compiled and then run, and the
output has to be compiled to be hou. This allows the real
program to be used. Thus the Makefile rule looks like:
${PROG}: ${PROG}.c
- ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
- ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS}${PROG}: ${PROG}.c
+ ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
+ ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS}which then compiles like:
-cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 hou.c -o hou -lm
-./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 -xc - -o hou -lmcc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 hou.c -o hou -lm
+./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes -O3 -xc - -o hou -lmThe LDFLAGS were updated to have -lm as the
author suggested it uses the math.h library which not all
systems link in by default (Linux for instance does not).
e. The only way it would work before that is if one did
something like:
-ln -sf prog eprog
-PATH=$PATH:. ; eprog '...'ln -sf prog eprog
+PATH=$PATH:. ; eprog '...'since otherwise the first character would not be e but
rather a dot (./eprog). This was done by adding to the
Makefile -include libgen.h and adding to
main() after the variable declaration (V*A;)
the code:
*K=basename(*K);*K=basename(*K);This was done for both the prog.c
and prog.alt.c. The Makefile was
also updated to build eprog and eprog.alt to
@@ -4578,9 +4600,9 @@ href="2020/endoh3/index.html">index.html)
Cody fixed the script run_clock.sh which gave a funny error when running it:
-$ ./run_clock.sh
--bash: ./run_clock.sh: cannot execute: required file not found$ ./run_clock.sh
+-bash: ./run_clock.sh: cannot execute: required file not foundIf run from within vim a different error message occurred:
/bin/bash: ./run_clock.sh: /usr/bin/end: bad interpreter: No such file or directory
though this was only noticed later on after it was fixed.
diff --git a/thanks-for-help.md b/thanks-for-help.md index 3f1b26a89..a0d008c43 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -392,6 +392,43 @@ We encourage you to read the [compilers.html](1986/marshall/compilers.html) file see how odd this problem was and what Cody did to fix it, if nothing else but for entertainment! +Also, after all warnings but one that could not be silenced were disabled, +Cody changed the alt code (which was not the same as the original - see above +for details or try `make diff_orig_alt` in the directory) slightly so that it +was possible to silence it. In particular: + +```c + P ( a ) char a ; { a ; while( a > " B " +``` + +which gave: + +``` +marshall.alt.c:13:55: warning: ordered comparison between pointer and integer ('char' and 'char *') + P ( a ) char a ; { a ; while( a > " B " + ~ ^ ~~~~~~~~ +1 warning generated. +``` + +was changed to: + +```c + P ( a ) char a ; { a ; while((char *)a > " B " +``` + +which gave: + +``` +marshall.alt.c:13:48: warning: cast to 'char *' from smaller integer type 'char' [-Wint-to-pointer-cast] + P ( a ) char a ; { a ; while((char *)a > " B " + ^~~~~~~~~ +1 warning generated. + +``` + +which can be disabled. It results in the same behaviour but this way no warnings +are produced. + ## [1986/pawka](1986/pawka/pawka.c) ([index.html](1986/pawka/index.html))