From 3b273d3822602f62e1f1a0bf2a1ff62750b7d1e2 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 13 Mar 2024 06:34:53 -0700 Subject: [PATCH] Silence another warning in 1986/marshall This warning was previously not possible to silence but by changing the (alt) code slightly (with same functionality including indeed the problem I documented in compilers.md) it now is. --- 1986/marshall/Makefile | 2 +- 1986/marshall/marshall.alt.c | 2 +- thanks-for-help.html | 394 ++++++++++++++++++----------------- thanks-for-help.md | 37 ++++ 4 files changed, 247 insertions(+), 188 deletions(-) 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.

1986/pawka (index.html)

@@ -525,7 +546,8 @@ was in 1986, as well as below.

it still required -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_prog
+
cd 1986/wall ; make diff_orig_prog

Some of the changes required: