Skip to content

Fix annoying warning about -fvisibility-inlines-hidden being passed to C files with GCC. - #2808

Merged
samsinsane merged 1 commit into
premake:masterfrom
ActuallyaDeviloper:master
Sep 26, 2026
Merged

samsinsane merged 1 commit into
premake:masterfrom
ActuallyaDeviloper:master

Conversation

@ActuallyaDeviloper

Copy link
Copy Markdown
Contributor

When compiling with GCC (not Clang) in Make or Ninja, I noticed the following annoying warning spam:

cc1: warning: command-line option '-fvisibility-inlines-hidden' is valid for C++/ObjC++ but not for C

Apparently this flag is only for C++. (Source: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html, where this option is listed at "command-line options that are only meaningful for C++ programs".)

The solution: Only pass this flag to the C++ compiler.

To reproduce:

Details

Reproduce by creating a premake5.lua

workspace "Repro"
	configurations { "Debug" }
	location "build/%{_ACTION}"
project "Repro"
	kind "StaticLib"
	language "C"
	inlinesvisibility "Hidden"
	files { "main.c" }

compiling a main.c

int f(void) { return 0; }

and compile with premake5 gmake && cd build/gmake && make or the equivalent ninja backend.

AI disclosure: The fix was suggested by Claude Opus 5.5. I reviewed the code and created this pull request.

@nickclark2016 nickclark2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Appreciate the AI disclosure :)

@samsinsane
samsinsane merged commit 71f2d33 into premake:master Sep 26, 2026
259 of 262 checks passed
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.

4 participants