Skip to content

SCI: Fix GCC warning #6674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 1, 2025
Merged

SCI: Fix GCC warning #6674

merged 2 commits into from
Jun 1, 2025

Conversation

orgads
Copy link
Contributor

@orgads orgads commented Jun 1, 2025

Use default initialization for dummy.

In file included from engines/sci/engine/savegame.cpp:26:
In member function 'void Common::Serializer::syncAsUint16LE(T&, Version, Version) [with T = short unsigned int]',
    inlined from 'void Common::Serializer::syncAsUint16LE(T&, Version, Version) [with T = short unsigned int]' at common/serializer.h:120:2,
    inlined from 'void Sci::syncWithSerializer(Common::Serializer&, reg_t&)' at engines/sci/engine/savegame.cpp:77:18,
    inlined from 'void Sci::syncWithSerializer(Common::Serializer&, Node&)' at engines/sci/engine/savegame.cpp:96:20,
    inlined from 'void Sci::SegmentObjTableEntrySyncer<T>::operator()(Common::Serializer&, typename T::Entry&, int) const [with T = Sci::NodeTable]' at engines/sci/engine/savegame.cpp:136:23,
    inlined from 'void Sci::ArraySyncer<T, Syncer>::operator()(Common::Serializer&, Common::Array<T>&) const [with T = Sci::SegmentObjTable<Sci::Node>::Entry; Syncer = Sci::SegmentObjTableEntrySyncer<Sci::NodeTable>]' at engines/sci/engine/savegame.cpp:168:8,
    inlined from 'void Sci::syncArray(Common::Serializer&, Common::Array<T>&) [with T = SegmentObjTable<Node>::Entry; Syncer = SegmentObjTableEntrySyncer<NodeTable>]' at engines/sci/engine/savegame.cpp:183:6,
    inlined from 'void Sci::sync_Table(Common::Serializer&, T&) [with T = NodeTable]' at engines/sci/engine/savegame.cpp:499:62,
    inlined from 'virtual void Sci::NodeTable::saveLoadWithSerializer(Common::Serializer&)' at engines/sci/engine/savegame.cpp:507:23:
common/serializer.h:49:30: warning: 'dummy' may be used uninitialized [-Wmaybe-uninitialized]
   49 |                         TYPE tmp = val; \
      |                              ^~~
common/serializer.h:120:9: note: in expansion of macro 'SYNC_AS'
  120 |         SYNC_AS(Uint16LE, uint16, 2)
      |         ^~~~~~~

orgads added 2 commits June 1, 2025 13:35
Use default initialization for dummy.

In file included from engines/sci/engine/savegame.cpp:26:
In member function 'void Common::Serializer::syncAsUint16LE(T&, Version, Version) [with T = short unsigned int]',
    inlined from 'void Common::Serializer::syncAsUint16LE(T&, Version, Version) [with T = short unsigned int]' at common/serializer.h:120:2,
    inlined from 'void Sci::syncWithSerializer(Common::Serializer&, reg_t&)' at engines/sci/engine/savegame.cpp:77:18,
    inlined from 'void Sci::syncWithSerializer(Common::Serializer&, Node&)' at engines/sci/engine/savegame.cpp:96:20,
    inlined from 'void Sci::SegmentObjTableEntrySyncer<T>::operator()(Common::Serializer&, typename T::Entry&, int) const [with T = Sci::NodeTable]' at engines/sci/engine/savegame.cpp:136:23,
    inlined from 'void Sci::ArraySyncer<T, Syncer>::operator()(Common::Serializer&, Common::Array<T>&) const [with T = Sci::SegmentObjTable<Sci::Node>::Entry; Syncer = Sci::SegmentObjTableEntrySyncer<Sci::NodeTable>]' at engines/sci/engine/savegame.cpp:168:8,
    inlined from 'void Sci::syncArray(Common::Serializer&, Common::Array<T>&) [with T = SegmentObjTable<Node>::Entry; Syncer = SegmentObjTableEntrySyncer<NodeTable>]' at engines/sci/engine/savegame.cpp:183:6,
    inlined from 'void Sci::sync_Table(Common::Serializer&, T&) [with T = NodeTable]' at engines/sci/engine/savegame.cpp:499:62,
    inlined from 'virtual void Sci::NodeTable::saveLoadWithSerializer(Common::Serializer&)' at engines/sci/engine/savegame.cpp:507:23:
common/serializer.h:49:30: warning: 'dummy' may be used uninitialized [-Wmaybe-uninitialized]
   49 |                         TYPE tmp = val; \
      |                              ^~~
common/serializer.h:120:9: note: in expansion of macro 'SYNC_AS'
  120 |         SYNC_AS(Uint16LE, uint16, 2)
      |         ^~~~~~~
@orgads orgads requested a review from bluegr June 1, 2025 10:35
@orgads
Copy link
Contributor Author

orgads commented Jun 1, 2025

The first commit is not needed for the fix, but I still prefer that you review it.

@bluegr
Copy link
Member

bluegr commented Jun 1, 2025

Thanks. Has this been tested with different SCI games, using a debug build?

@orgads
Copy link
Contributor Author

orgads commented Jun 1, 2025

I only have SQ5, and not sure how to reach this condition. Tested on release build without NDEBUG :)

@bluegr
Copy link
Member

bluegr commented Jun 1, 2025

I've tested this with different SCI games. To test, you can always use the SCI demos, found in our demos page.

Thanks! Merging

@bluegr bluegr merged commit 6812ba0 into scummvm:master Jun 1, 2025
8 checks passed
@orgads orgads deleted the sci-warning branch June 1, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants