simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sun Feb 19 12:42:15 GMT 2023
TL;DR:
448095e Undead: be a bit more careful about sprintf buffer sizes
5fa60c4 Unequal: use %u to format an unsigned int
d7b9318 Replace a buch of "const static" with "static const"
3c34683 Use unreserved macro names for multiple-include protection
26c7f3a Miscellaneous const fixes
e8ac038 Convert a lot of floating-point constants to single precision
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2023-02-19 12:42:15
commit 448095ede815b1a63ddedc602c3ac768a0d52968
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=448095ede815b1a63ddedc602c3ac768a0d52968;hp=fccd2a55e705a991f22f1aa393c9324846d80515
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 21:26:38 2023 +0000
Undead: be a bit more careful about sprintf buffer sizes
undead.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit 5fa60c4d460e9054b9e6cb62549dd40612c0ea48
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5fa60c4d460e9054b9e6cb62549dd40612c0ea48;hp=448095ede815b1a63ddedc602c3ac768a0d52968
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 21:32:58 2023 +0000
Unequal: use %u to format an unsigned int
unequal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit d7b931824b452a6b70a599c69f4f1843f1b2daa5
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=d7b931824b452a6b70a599c69f4f1843f1b2daa5;hp=5fa60c4d460e9054b9e6cb62549dd40612c0ea48
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 22:04:52 2023 +0000
Replace a buch of "const static" with "static const"
C18 section 6.11.5 says that "const static" is obsolescent.
unfinished/group.c | 2 +-
unfinished/numgame.c | 44 ++++++++++++++++++++++----------------------
2 files changed, 23 insertions(+), 23 deletions(-)
commit 3c3468355f8cf3dd644058ab239b948f8facebfa
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=3c3468355f8cf3dd644058ab239b948f8facebfa;hp=d7b931824b452a6b70a599c69f4f1843f1b2daa5
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 23:07:44 2023 +0000
Use unreserved macro names for multiple-include protection
Some headers used macros named like _THING_H for multiple-include
protection. That style of name is reserved in ISO C, though, so I've
replaced it with PUZZLES_THING_H which is my favourite of the other
styles in use.
loopgen.h | 4 ++--
penrose.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
commit 26c7f3aa285a45176c940afebe3885ad2be2ed65
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=26c7f3aa285a45176c940afebe3885ad2be2ed65;hp=3c3468355f8cf3dd644058ab239b948f8facebfa
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 23:14:12 2023 +0000
Miscellaneous const fixes
These are cases where -Wcast-qual complained and the only change needed
was to add or remove a "const" (or sometimes an entire cast).
loopy.c | 2 +-
magnets.c | 4 ++--
random.c | 2 +-
signpost.c | 6 +++---
untangle.c | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
commit e8ac0381f976f2dfd70fbe52e0ec59c1a8da9df6
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e8ac0381f976f2dfd70fbe52e0ec59c1a8da9df6;hp=26c7f3aa285a45176c940afebe3885ad2be2ed65
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Feb 18 18:52:21 2023 +0000
Convert a lot of floating-point constants to single precision
For reasons now lost to history, Puzzles generally uses single-precision
floating point. However, C floating-point constants are by default
double-precision, and if they're then operated on along with a
single-precision variable the value of the variable gets promoted to
double precision, then the operation gets done, and then often the
result gets converted back to single precision again.
This is obviously silly, so I've used Clang's "-Wdouble-promotion" to
find instances of this and mark the constants as single-precision as
well. This is a bit awkward for PI, which ends up with a cast. Maybe
there should be a PIF, or maybe PI should just be single-precision.
This doesn't eliminate all warnings from -Wdouble-promotion. Some of
the others might merit fixing but adding explicit casts to double just
to shut the compiler up would be going too far, I feel.
cube.c | 10 +++++-----
drawing.c | 8 ++++----
emcc.c | 6 +++---
flip.c | 2 +-
galaxies.c | 8 ++++----
inertia.c | 2 +-
net.c | 12 ++++++------
netslide.c | 4 ++--
samegame.c | 2 +-
twiddle.c | 8 ++++----
undead.c | 2 +-
11 files changed, 32 insertions(+), 32 deletions(-)
More information about the tartarus-commits
mailing list