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

Allow operand number formats on g++14 #75690

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

inogenous
Copy link
Contributor

Summary

Bugfixes "Allow operand number formats on g++14"

Purpose of change

Allow compiling on g++14 (debian sid) without compilation errors.

Describe the solution

Compilation fails on my rig. My compiler (see version below) gives this error when compiling. Source does not build.

$ g++ --version
g++ (Debian 14.2.0-1) 14.2.0
src/magic.cpp: In member function ‘void spellcasting_callback::display_spell_info(size_t)’:
src/magic.cpp:2624:24: error: ISO C++11 does not support %n$ operand number formats [-Werror=format=]
 2624 |             ImGui::Text( _( "Spawn item group %1$s %2$d times" ),
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2625 |                          sp.effect_data().c_str(),
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~
 2626 |                          sp.damage( pc ) );
      |                          ~~~~~~~~~~~~~~~~~

Compiler flags used:

CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_ctime,include_file_mtime ccache g++ -Isrc -isystem src/third-party -DRELEASE -DGIT_VERSION -DTILES -DUSE_HOME_DIR -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Os -Wodr -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-dangling-reference -Wno-c++20-compat -Wredundant-decls -g -fsigned-char -std=c++17 -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -D_REENTRANT -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread -MMD -MP -Winvalid-pch -include pch/main-pch.hpp -c src/magic.cpp -o obj/tiles/magic.o

Describe alternatives you've considered

Have considered perpetually carrying along a local patch that allows me to at least compile the game.

Testing

Ok so this is a bit embarrassing. I have not actually tested the functionality being changed (is it magiclysm?). What I have tested though is compiling the game, which does not work on master as of 207d942 using my compiler, but works on this branch.

Additional context

From #74341 .

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) labels Aug 15, 2024
@github-actions github-actions bot requested a review from KorGgenT August 15, 2024 00:08
@inogenous inogenous force-pushed the operand-number-formats branch from 8939353 to 4a60f69 Compare August 15, 2024 00:09
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Aug 15, 2024
@inogenous inogenous force-pushed the operand-number-formats branch from 4a60f69 to ba39c09 Compare August 15, 2024 00:44
My compiler (`g++ (Debian 14.2.0-1) 14.2.0`) gives this error when
compiling:
```
src/magic.cpp: In member function ‘void spellcasting_callback::display_spell_info(size_t)’:
src/magic.cpp:2624:24: error: ISO C++11 does not support %n$ operand number formats [-Werror=format=]
 2624 |             ImGui::Text( _( "Spawn item group %1$s %2$d times" ),
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2625 |                          sp.effect_data().c_str(),
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~
 2626 |                          sp.damage( pc ) );
      |                          ~~~~~~~~~~~~~~~~~
```

Compiler flags used:
```
CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_ctime,include_file_mtime ccache g++ -Isrc -isystem src/third-party -DRELEASE -DGIT_VERSION -DTILES -DUSE_HOME_DIR -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Os -Wodr -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-dangling-reference -Wno-c++20-compat -Wredundant-decls -g -fsigned-char -std=c++17 -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -D_REENTRANT -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -pthread -MMD -MP -Winvalid-pch -include pch/main-pch.hpp -c src/magic.cpp -o obj/tiles/magic.o
```
@inogenous inogenous force-pushed the operand-number-formats branch from ba39c09 to 11ac450 Compare August 15, 2024 01:21
@akrieger
Copy link
Member

Six of one, half a dozen of the other. Either imgui does the substitution or string_formatter does.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Aug 15, 2024
@Maleclypse Maleclypse merged commit f77e07e into CleverRaven:master Aug 15, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants