Repository navigation
more warnings - #363
Merged
Merged
more warnings#363
Conversation
Smattr
force-pushed
the
smattr/f8dad399-46d6-4a88-abb2-b32a9b559747
branch
from
October 15, 2026 00:56
bb96632 to
f80dd7a
Compare
GCC says:
murphi-format/src/lex_get_token.c: In function ‘lex_get_token’:
murphi-format/src/lex_get_token.c:259:28: warning: conversion from
‘int’ to ‘char’ may change value [-Wconversion]
259 | if (may_be_operator(0, first)) {
| ^~~~~
murphi-format/src/lex_get_token.c:320:33: warning: conversion from
‘int’ to ‘char’ may change value [-Wconversion]
320 | if (!may_be_operator(i, c)) {
| ^
An interesting quirk is that my initial attempt to fix this by making
`may_be_operator` accept an `int` failed on platforms with signed
`char`. When reading signed `char` values out of `OPERATORS` they are
then sign-extended when comparing against (the now `int`) `c`. For
values < 0, this sign extension produces a different value than the cast
to `unsigned char` that `getc` does.
This change observes that the arguments passed in originated from
`getc`, so we should respect that they were delivered to us as
`unsigned char` values.
Reported-by: GCC 16.2.1
GCC says:
murphi2murphi/src/Pipeline.cc: In member function
‘void Pipeline::finalise()’:
murphi2murphi/src/Pipeline.cc:33:40: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
33 | stages[0]->sync_to(position(nullptr, UINT_MAX, UINT_MAX));
| ^~~~~~~~
murphi2murphi/src/Pipeline.cc:33:50: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
33 | stages[0]->sync_to(position(nullptr, UINT_MAX, UINT_MAX));
| ^~~~~~~~
Reported-by: GCC 16.2.1
GCC says:
In file included from murphi2xml/src/XMLPrinter.cc:1:
murphi2xml/src/XMLPrinter.h:101:70: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
101 | void sync_to(…, UINT_MAX,
| ^~~~~~~~
murphi2xml/src/XMLPrinter.h:102:61: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
102 | UINT_MAX));
| ^~~~~~~~
In file included from murphi2xml/src/main.cc:2:
murphi2xml/src/XMLPrinter.h:101:70: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
101 | void sync_to(…, UINT_MAX,
| ^~~~~~~~
murphi2xml/src/XMLPrinter.h:102:61: warning: signed conversion from
‘unsigned int’ to ‘rumur::position::counter_type’ {aka ‘int’}
changes value from ‘4294967295’ to ‘-1’ [-Wsign-conversion]
102 | UINT_MAX));
| ^~~~~~~~
Reported-by: GCC 16.2.1
GCC says:
rumur/src/process.cc: In function ‘int run(…
rumur/src/process.cc:250:36: warning: conversion to ‘long unsigned
int’ from ‘off_t’ {aka ‘long int’} may change the sign of the result
[-Wsign-conversion]
250 | input.size() - input_offset);
| ^~~~~~~~~~~~
Reported-by: GCC 16.2.1
Smattr
force-pushed
the
smattr/f8dad399-46d6-4a88-abb2-b32a9b559747
branch
2 times, most recently
from
October 17, 2026 01:38
49530ac to
2c23dd7
Compare
Apart from de-duplicating code, this unifies on the idiom `assert(0 && "unreachable")` as opposed to `assert(!"unreachable")`, the latter of which triggers Clang -Wstring-conversion warnings. Reported-by: AppleClang 21.0.0.21000101
…sion Reported-by: AppleClang 21.0.0.21000101
Reported-by: AppleClang 21.0.0.21000101
This required suppressing this on Flex-generated code. Without this, compilation with Clang (AppleClang 21.0.0.21000334) on macOS triggers warnings in Flex boilerplate. As with 4c9fd5b, we need to disable this warning on x86-64 macOS in CI because otherwise it triggers on libgmp headers. As with 4c9fd5b, I do not understand why `SYSTEM` does not suppress these nor why only a subset of macOS builds are affected.
GCC says:
rumur/src/smt/translate.cc: In function ‘std::string smt::lower(const
std::string&)’:
rumur/src/smt/translate.cc:281:11: warning: conversion from ‘int’ to
‘char’ may change value [-Wconversion]
281 | s1 += (int)tolower(c);
| ^~~~~~~~~~~~~~~
Reported-by: GCC 16.2.1
This required suppressing Wshorten-64-to-32 on Flex-generated code. Without this, compilation with Clang (AppleClang 21.0.0.21000334) on macOS triggers warnings in Flex boilerplate. As with 4c9fd5b, we need to partially disable this warning on x86-64 macOS in CI because otherwise it triggers on libgmp headers. As with 4c9fd5b, I do not understand why `SYSTEM` does not suppress these nor why only a subset of macOS builds are affected.
Smattr
force-pushed
the
smattr/f8dad399-46d6-4a88-abb2-b32a9b559747
branch
from
October 17, 2026 15:31
2c23dd7 to
99f63da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.