Updates to 1989/westley
I have tried to make the README.md file less cluttered wrt the clang defects and instead just show how to use the entry, referring to the bugs.md for those who need to know. Added script compile.sh which generates the files and tries to compile them. The script sleeps (by default approximately 1 second) in between commands but this can be changed to another value (including 0). One can also change the compiler path in case their compiler is clang or in the case of macOS gcc IS clang. The README.md refers to this and gives examples. The bugs.md and the thanks-for-fixes.md files have been updated for these changes and additions. For those who do not know of the clang defects it is discussed in the bugs.md and unfortunately for this entry there might be little that can be done. I haven't tried to understand the entry deeply and maybe doing so would give some ideas for fixes (beyond what I already did which lets the main program compile with clang - or at least versions that allow a fourth arg to main()) but this seems less important for now.
This commit is contained in:
1 parent
ef456bfb1e
commit
4ef3afcd74
4 files changed
+134
-29
No files matched your search
+32
-15
@@ -11,36 +11,42 @@ make all
|
||||
```
|
||||
|
||||
|
||||
NOTE: this entry only partly works with clang; clang requires that the second, third and
|
||||
fourth args to `main()` be `char **`. Only `westley.c` and `ver0.c` (see below) will
|
||||
compile with clang. It's possible to get `ver1.c` to compile too but this causes
|
||||
problems with generating the output of the remaining files so we have opted, at
|
||||
least for now, to not do that, as it does not have to output just source code.
|
||||
The original source code sometimes segfaults with `ver2` which also happens with
|
||||
the fix but it'll only compile with a compiler that does not require the second,
|
||||
third and fourth args of `main()` to be a `char **`.
|
||||
|
||||
NOTE: this entry only partly works with clang and only some versions of clang,
|
||||
due to defects in the compiler. See [bugs.md](/bugs.md) for more details.
|
||||
|
||||
## Try:
|
||||
|
||||
Try compiling and running the 4 resulting programs like:
|
||||
|
||||
```sh
|
||||
./compile.sh
|
||||
```
|
||||
|
||||
This will remove the programs and then run:
|
||||
|
||||
```
|
||||
./westley < westley.c > ver0.c
|
||||
./westley 1 < westley.c > ver1.c
|
||||
./westley 1 2 < westley.c > ver2.c
|
||||
./westley 1 2 3 < westley.c > ver3.c
|
||||
```
|
||||
|
||||
followed by compiling each version.
|
||||
|
||||
Try compiling and running the 4 resulting programs. To compile try:
|
||||
If you need to specify an alternate compiler path, say because your default
|
||||
compiler is clang (or in the case of macOS gcc is clang) you can do so like:
|
||||
|
||||
```sh
|
||||
make ver0
|
||||
make ver1
|
||||
make ver2
|
||||
make ver3
|
||||
CC=/opt/local/bin/gcc-mp-12 ./compile.sh
|
||||
```
|
||||
|
||||
Then run:
|
||||
If you wish to delay the script or remove the delay you can do so like:
|
||||
|
||||
```sh
|
||||
DELAY=0 ./compile.sh
|
||||
```
|
||||
|
||||
Finally try:
|
||||
|
||||
```sh
|
||||
./westley
|
||||
@@ -51,6 +57,17 @@ echo Version 2 | ./ver2
|
||||
echo Version 3 | ./ver3
|
||||
```
|
||||
|
||||
|
||||
### INAFIAB - it's not a feature it's a bug :-(
|
||||
|
||||
There might have been a segfault that was fixed in the original code but as we
|
||||
no longer know what condition or conditions caused this we cannot be sure. It
|
||||
seems like, according to various files, that `ver1` and/or `ver2` also have this
|
||||
problem but we also do not know about the status of this. See
|
||||
[bugs.md](/bugs.md) for more information.
|
||||
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user