Fix 1984/decot to not require -traditional-cpp

This was fun to fix. What prompted me to do so is that I noticed that
the patch from Yusuke Endoh actually doesn't work in fedora linux. It never
worked with clang as it required -traditional-cpp and also had
non-standard second and third args type to main (not a char ** but
implicit int). No more. This entry now works with both linux and macOS!

I was able to remove all the macros as they were problematic and not
needed. The code that used them was updated to be what was necessary.

Add to Makefile inclusion of stdio.h and math.h (printf, floor).
Some systems require -lm so that was also added to the Makefile.

Very little else was required to make it work.

The decot.alt.c is the version patched by Yusuke but fixed by me to
compile with fedora's gcc.

Removed this entry from bugs.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-04 06:11:38 -07:00
1 parent 7832ef5e46
commit 606e01cb78
5 files changed
+97 -56

No files matched your search

+4 -9
View File
@@ -63,7 +63,7 @@ CDEFINE=
# Include files that are needed to compile
#
CINCLUDE=
CINCLUDE= -include stdio.h -include math.h
# Optimization
#
@@ -75,7 +75,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
LIBS= -lm
# C compiler to use
#
@@ -114,12 +114,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
# FORCE use of -traditional-cpp
#
CFLAGS+= -traditional-cpp
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -134,7 +130,6 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: this entry requires a compiler that supports -traditional-cpp."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable