simon-git: puzzles (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Feb 18 10:25:49 GMT 2023
TL;DR:
615a337 Add -Wmissing-prototypes to STRICT clang builds.
dbced09 Fix unused variable warnings from clang.
873d613 Fix missing statics and #includes on variables.
b591bbd Buildscr: include a test build with clang + STRICT.
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2023-02-18 10:25:49
commit 615a337e426c0dc598b0bcdd9aec6bcbc4c50d2c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=615a337e426c0dc598b0bcdd9aec6bcbc4c50d2c;hp=3a3e491a8bc624eb1c3b34e54ebee8d33942add2
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 18 07:16:12 2023 +0000
Add -Wmissing-prototypes to STRICT clang builds.
Ben added -Wmissing-declarations in commit 3a3e491a8bc624e for gcc
builds, and observed that clang's option of the same name doesn't do
the same job. But clang does _have_ an option to do the same job: it's
just spelled differently. Added -Wmissing-prototypes in clang builds,
so that those will check the same thing.
cmake/platforms/unix.cmake | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
commit dbced097ac16973f648ad2f024cc2302fa187578
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=dbced097ac16973f648ad2f024cc2302fa187578;hp=615a337e426c0dc598b0bcdd9aec6bcbc4c50d2c
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 18 07:06:27 2023 +0000
Fix unused variable warnings from clang.
If you enable -DSTRICT=ON in cmake and also build with clang, it
reports a couple of variables set but not otherwise used. One was
genuinely unused ('loop_found' in loop_deductions in Loopy); the other
is used by debug statements that are usually but not always compiled
out.
lightup.c | 2 ++
loopy.c | 3 +--
2 files changed, 3 insertions(+), 2 deletions(-)
commit 873d613dd597f550b1b64946c4577b012d61d1c9
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=873d613dd597f550b1b64946c4577b012d61d1c9;hp=dbced097ac16973f648ad2f024cc2302fa187578
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 18 07:14:05 2023 +0000
Fix missing statics and #includes on variables.
After Ben fixed all the unwanted global functions by using gcc's
-Wmissing-declarations to spot any that were not predeclared, I
remembered that clang has -Wmissing-variable-declarations, which does
the same job for global objects. Enabled it in -DSTRICT=ON, and made
the code clean under it.
Mostly this was just a matter of sticking 'static' on the front of
things. One variable was outright removed ('verbose' in signpost.c)
because after I made it static clang was then able to spot that it was
also unused.
The more interesting cases were the ones where declarations had to be
_added_ to header files. In particular, in COMBINED builds, puzzles.h
now arranges to have predeclared each 'game' structure defined by a
puzzle backend. Also there's a new tiny header file gtk.h, containing
the declarations of xpm_icons and n_xpm_icons which are exported by
each puzzle's autogenerated icon source file and by no-icon.c. Happily
even the real XPM icon files were generated by our own Perl script
rather than being raw xpm output from ImageMagick, so there was no
difficulty adding the corresponding #include in there.
cmake/platforms/unix.cmake | 2 +-
dominosa.c | 4 ++--
galaxies.c | 4 ++--
gtk.c | 10 +++-------
gtk.h | 7 +++++++
icons/cicon.pl | 1 +
latin.c | 2 +-
lightup.c | 2 +-
list.c | 4 ----
magnets.c | 6 +++---
map.c | 2 +-
no-icon.c | 2 ++
pattern.c | 4 ++--
pearl.c | 2 +-
penrose.c | 4 ++--
puzzles.h | 4 ++++
signpost.c | 3 +--
singles.c | 2 +-
slant.c | 2 +-
solo.c | 2 +-
tents.c | 2 +-
tree234.c | 8 ++++----
unequal.c | 4 ++--
unruly.c | 4 ++--
version.c | 1 +
25 files changed, 47 insertions(+), 41 deletions(-)
commit b591bbdb5f1588f34bb07729057101d4f8b6907a
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b591bbdb5f1588f34bb07729057101d4f8b6907a;hp=873d613dd597f550b1b64946c4577b012d61d1c9
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 18 08:53:59 2023 +0000
Buildscr: include a test build with clang + STRICT.
I've just enabled a warning that only fires in that mode, so we need
to keep running the build in that configuration to ensure further
instances of the warning aren't introduced.
Buildscr | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
More information about the tartarus-commits
mailing list