Skip to content
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

Fix gcc/MSVC compiler warnings #7686

Merged
merged 1 commit into from
Jan 29, 2025
Merged

Conversation

StephenCWills
Copy link
Member

gcc:

/home/runner/work/devilutionX/devilutionX/Source/items.cpp: In function ‘void devilution::UseItem(Player&, item_misc_id, SpellID, int)’:
/home/runner/work/devilutionX/devilutionX/Source/items.cpp:4274:35: warning: unused variable ‘spellLevel’ [-Wunused-variable]
 4274 |                         const int spellLevel = player.GetSpellLevel(spellID);
      |                                   ^~~~~~~~~~

Also, this doesn't show up in CI, probably because the build folder is cached, but libzt was generating a large number of warnings on my system because we weren't applying the -w flag to the zt_pic library.


MSVC:

Warning: D:\a\devilutionX\devilutionX\Source\engine\path.cpp(173): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data

@StephenCWills
Copy link
Member Author

StephenCWills commented Jan 29, 2025

Should we do something about the fmt compiler warnings in CI? I don't see those on my system.. maybe because I don't build with -DDEVILUTIONX_SYSTEM_LIBFMT=OFF.

EDIT: Actually, looking more closely, -DDEVILUTIONX_SYSTEM_LIBFMT=OFF wouldn't matter. Seems to me that the warning occurs because the compiler doesn't recognize the [[noreturn]] directive on the forward declaration for app_fatal() for some reason. Maybe a gcc version issue.

@glebm glebm merged commit ba77325 into diasurgical:master Jan 29, 2025
23 checks passed
@StephenCWills StephenCWills deleted the fix-warnings branch January 29, 2025 17:58
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