cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
895 stars 115 forks source link

inlining failed in call to ‘fsg_get_steam_game_path’ #723

Closed gtalis closed 2 years ago

gtalis commented 2 years ago

Hi,

Based on master latest (2eb4fe3b36f50989ecc9f33a8aea4fc9ee769908), I bumped into the following build error.

OS: Ubuntu 20.10 Toolchain: gcc 10.3.0

$ /usr/bin/cc --version cc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[ 21%] Building C object src/cdogs/CMakeFiles/cdogs.dir/map_wolf.c.o
In file included from /src/cdogs/map_wolf.c:30:
src/cdogs/map_wolf.c: In function ‘MapWolfLoadCampaignsFromSystem’:
src/cdogs/find_steam_game.h:112:7: error: inlining failed in call to ‘fsg_get_steam_game_path’: --param max-inline-insns-single limit reached [-Werror=inline]
  112 |  void fsg_get_steam_game_path(char *out, const char *name)
      |       ^~~~~~~~~~~~~~~~~~~~~~~
src/cdogs/map_wolf.c:2497:2: note: called from here
 2497 |  fsg_get_steam_game_path(buf, WOLF_STEAM_NAME);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/cdogs/map_wolf.c:30:
src/cdogs/find_steam_game.h:112:7: error: inlining failed in call to ‘fsg_get_steam_game_path’: --param max-inline-insns-single limit reached [-Werror=inline]
  112 |  void fsg_get_steam_game_path(char *out, const char *name)
      |       ^~~~~~~~~~~~~~~~~~~~~~~
src/cdogs/map_wolf.c:2528:2: note: called from here
 2528 |  fsg_get_steam_game_path(buf, SPEAR_STEAM_NAME);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The following patch makes it go away by increasing the changing the limit of the inline functions size, though I am not sure it is the right way to fix the issue:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 096c328b..d9e91707 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,6 +96,7 @@ if(MSVC)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 -WX -wd\"4996\" -wd\"4204\"")
 else()
        add_definitions(
+               -finline-limit=500
                -fsigned-char
                -Wall -W
                -Wstrict-prototypes -Wpointer-arith -Wcast-qual)
cxong commented 2 years ago

Interesting; I'll look into updating find_steam_game.h to get around this