[Scummvm-tracker] [ScummVM :: Bugs] #11538: ODR violations

ScummVM :: Bugs trac at scummvm.org
Mon Jul 20 15:07:08 UTC 2020


#11538: ODR violations
-------------------+-----------------------
Reporter:  lacc97  |      Owner:  (none)
    Type:  defect  |     Status:  new
Priority:  normal  |  Component:  --Unset--
Keywords:          |       Game:
-------------------+-----------------------
 Compilation of 2.1.2 with -flto on Gentoo Linux (GCC 10.1) generates ODR
 warnings.
  * engines/illusions
 {{{
 ./engines/illusions/bbdou/bbdou_credits.h:35:8: warning: type ‘struct
 CreditsItem’ violates the C++ One Definition Rule [-Wodr]
    35 | struct CreditsItem {
       |        ^
 ./engines/illusions/duckman/duckman_credits.h:32:8: note: a different type
 is defined in another translation unit
    32 | struct CreditsItem {
       |        ^
 ./engines/illusions/bbdou/bbdou_credits.h:36:7: note: the first difference
 of corresponding definitions is field ‘isUsed’
    36 |  bool isUsed;
       |       ^
 ./engines/illusions/duckman/duckman_credits.h:33:9: note: a field with
 different name is defined in another translation unit
    33 |  uint32 objectId;
       |
 }}}
  * audio
 {{{
 audio/fmopl.cpp:42: warning: ‘create’ violates the C++ One Definition Rule
 [-Wodr]
    42 |  OPL *create(Config::OplType type);
       |
 audio/alsa_opl.cpp:344: note: return value type mismatch
   344 | OPL *create(Config::OplType type) {
       |
 audio/alsa_opl.cpp:47: note: type name ‘OPL::ALSA::OPL’ should match type
 name ‘OPL::OPL’
    47 | class OPL : public ::OPL::RealOPL {
       |
 ./engines/scumm/players/player_ad.h:32:7: note: the incompatible type is
 defined here
    32 | class OPL;
       |       ^
 audio/alsa_opl.cpp:344: note: ‘create’ was previously declared here
   344 | OPL *create(Config::OplType type) {
       |
 audio/alsa_opl.cpp:344: note: code may be misoptimized unless ‘-fno-
 strict-aliasing’ is used
 }}}

 As far as I can tell this doesn't result in runtime bugs but it is still
 undefined behaviour and may cause problems in the future.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/11538>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list