diff --git a/src/_premake_init.lua b/src/_premake_init.lua index bcb445ed..5c395739 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1336,6 +1336,12 @@ } } + api.register { + name = "unsignedchar", + scope = "config", + kind = "boolean", + } + ----------------------------------------------------------------------------- -- -- Field name aliases for backward compatibility diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index aa89bd4c..9fc65fd6 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -96,6 +96,10 @@ }, symbols = { On = "-g" + }, + unsignedchar = { + On = "-funsigned-char", + Off = "-fno-unsigned-char" } } diff --git a/tests/tools/test_gcc.lua b/tests/tools/test_gcc.lua index 4dfccfba..52c0adb1 100644 --- a/tests/tools/test_gcc.lua +++ b/tests/tools/test_gcc.lua @@ -788,3 +788,23 @@ test.contains({ "-std=gnu++17" }, gcc.getcxxflags(cfg)) test.contains({ }, gcc.getcflags(cfg)) end + +-- +-- Test unsigned-char flags. +-- + + function suite.sharedflags_onUnsignedChar() + unsignedchar "On" + + prepare() + test.contains({ "-funsigned-char" }, gcc.getcxxflags(cfg)) + test.contains({ "-funsigned-char" }, gcc.getcflags(cfg)) + end + + function suite.sharedflags_onNoUnsignedChar() + unsignedchar "Off" + + prepare() + test.contains({ "-fno-unsigned-char" }, gcc.getcxxflags(cfg)) + test.contains({ "-fno-unsigned-char" }, gcc.getcflags(cfg)) + end