Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
These are the only places that error without -Wno-tautological-compare in MAME master with Apple Clang 16 (which is also upstream Clang 16).

The midvunit is definitely an error. The rest may or may not be, if any of this is your code please make that call. Testing on GCC is also welcome.


Code
../../../../../src/emu/input.cpp:758:15: error: result of comparison of constant -1 with expression of type 'input_device_class' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
  758 |         if (devclass == ~input_device_class(0))
      |             ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/emu/input.cpp:773:26: error: result of comparison of constant -1 with expression of type 'input_item_id' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
  773 |         bool standard = (itemid != ~input_item_id(0));
      |                          ~~~~~~ ^  ~~~~~~~~~~~~~~~~~
../../../../../src/emu/input.cpp:811:16: error: result of comparison of constant -1 with expression of type 'input_item_modifier' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
  811 |                 if (modifier != ~input_item_modifier(0))
      |                     ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
../../../../../src/emu/input.cpp:1213:16: error: result of comparison of constant -1 with expression of type 'input_device_class' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
 1213 |                 if (devclass == ~input_device_class(0))
      |                     ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~

../../../../../src/mame/seibu/stfight_dev.cpp:292:15: error: result of comparison of constant -1 with expression of type 'const uint16_t' (aka 'const unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
  292 |                         if (src[x] == -1)
      |                             ~~~~~~ ^  ~~
../../../../../src/mame/midway/midvunit.cpp:426:32: error: result of comparison of constant 450 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
  426 |                                                 if (m_galil_output_index < 450)
      |      

../../../../../src/devices/machine/smioc.cpp:360:26: error: result of comparison of constant 4 with expression of type 'smioc_dma_parameter_t' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
  360 |         if (param >= 0 && param < (sizeof(paramNames) / sizeof(*paramNames)))
      |                           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
I've checked in a fix for the midvunit.h one. There's no visible effect on the emulation (it seems to be related to the incomplete steering wheel force feedback) but at least it's doing what it was intended to now.

Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
Not my code (it’s crusty old pre-C++ stuff), but b5c0c73 should shut up the ones in emu/input.cpp.

1 member likes this: R. Belmont
Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
And https://github.com/mamedev/mame/commit/72955160b97b352aca04e0c5c7c0144efa2471ba addresses smioc.cpp, although I have strong opinions about what that code is doing now. That plus hap's fix for stfight means I was able to do a full TOOLS=1 build from clean without -Wno-tautological-compare on Apple Clang 16 with no errors.

Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
...and the same for GCC 14.2.1 on Linux.

Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
Are you going to enable it for the main MAME build, or does it give other false positives? IIRC when GCC6 was released, everyone was complaining about it giving false positives in templates and macros, but it might have been made less aggressive since then.

Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
I'm thinking about it. I'd like to hear from anyone using other compiler versions first, but it increasingly seems like the way to do that is to enable it and see who yells.

Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
I went ahead and enabled it. For some reason it’s disabled separately for asmjs in toolchain.lua. If it wreaks havoc, it can be downgraded to a warning.

Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
Well that didn’t last long. clang for x86-64 Windows (LLP64) gets upset about code that makes no assumptions about the relative sizes of uint64_t and long. I can’t think of a way of avoiding it that isn’t gross. I’ve demoted it to a warning for now, so people can at least see it and avoid invoking its wrath for simpler stuff.

Joined: Dec 2015
Posts: 173
Likes: 12
A
AJR Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2015
Posts: 173
Likes: 12
I'm also getting this as a warning now:

Code
src/osd/interface/inputcode.h:382:36: warning: result of comparison of constant 15 with expression of type 'input_device_class' is always true [-Wtautological-constant-out-of-range-compare]
                assert(devclass >= 0 && devclass <= 0xf);
                                        ~~~~~~~~ ^  ~~~

Page 1 of 2 1 2

Link Copied to Clipboard
Who's Online Now
2 members (Duke, anoid), 183 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,328
Posts122,128
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com