cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.97k stars 983 forks source link

Prevent compiler warnings related to abnormal exit and fallthrough. #704

Closed eric-s-raymond closed 1 year ago

eric-s-raymond commented 1 year ago

This PR was motivated by a failed attempt to build go-interpreter/chezgo, which sets -Werrors..

It fixes several trivial warnings. There are a few others that look nontrivial, which I will investigate further.

No logic changes.

eric-s-raymond commented 1 year ago

Done.

With this change you're pretty close to compiling clean with -Werrors. I recommend pushing it the rest of the way.

jltaylor-us commented 1 year ago

Not that this should prevent us from merging this PR, but I thought we already built with -Werror...

On macOS, we use -Wall -Wextra -Werror -Wno-implicit-fallthrough, and from a quick glance it looks like the same in the linux makefiles. This PR will allow us to remove the -Wno-implicit-fallthrough – I've verified that make in a6osx/c succeeds after removing the flag (on macOS, obviously); other builds would have to be verified (but maybe we can assume the GitHub runners will cover it).

It looks like go-interpreter/chezgo is using a copy of the code already configured for a6osx from 6 years ago, which is before the a6osx makefile was updated to add -Wno-implicit-fallthrough (see #273).

Are there any other errors preventing a clean compile with -Werror with some other OS/compiler combination?