diff --git a/modules/d/tools/dmd.lua b/modules/d/tools/dmd.lua index d957ec7608..3401a5c662 100644 --- a/modules/d/tools/dmd.lua +++ b/modules/d/tools/dmd.lua @@ -305,6 +305,7 @@ Default = "-wi", High = "-wi", Extra = "-wi", + Everything = "-wi", }, } diff --git a/modules/d/tools/gdc.lua b/modules/d/tools/gdc.lua index 727d03ef45..5ecb74e07b 100644 --- a/modules/d/tools/gdc.lua +++ b/modules/d/tools/gdc.lua @@ -85,6 +85,7 @@ -- Default = "-w", -- TODO: check this... High = "-Wall", Extra = "-Wall -Wextra", + Everything = "-Weverything", }, symbols = { On = "-g", diff --git a/modules/d/tools/ldc.lua b/modules/d/tools/ldc.lua index ef881a9214..0900cf4ff2 100644 --- a/modules/d/tools/ldc.lua +++ b/modules/d/tools/ldc.lua @@ -121,6 +121,7 @@ Default = "-wi", High = "-wi", Extra = "-wi", -- TODO: is there a way to get extra warnings? + Everything = "-wi", }, symbols = { On = "-g", diff --git a/modules/vstudio/tests/vc200x/test_compiler_block.lua b/modules/vstudio/tests/vc200x/test_compiler_block.lua index 9fd3c56b54..30c4a3ddce 100644 --- a/modules/vstudio/tests/vc200x/test_compiler_block.lua +++ b/modules/vstudio/tests/vc200x/test_compiler_block.lua @@ -332,6 +332,23 @@ ]] end + function suite.runtimeLibraryIsDebug_onHighWarnings() + warnings "High" + prepare() + test.capture [[ + + ]] + end + -- -- Verify the correct warnings settings are used when FatalWarnings are enabled. diff --git a/modules/vstudio/tests/vc2010/test_compile_settings.lua b/modules/vstudio/tests/vc2010/test_compile_settings.lua index de91deddfc..9273c2c6b2 100644 --- a/modules/vstudio/tests/vc2010/test_compile_settings.lua +++ b/modules/vstudio/tests/vc2010/test_compile_settings.lua @@ -76,6 +76,18 @@ ]] end +-- +-- Ensure that high warnings lead to the level 4 debug option +-- + function suite.warningLevel_onHighWarnings() + warnings "High" + prepare() + test.capture [[ + + NotUsing + Level4 + ]] + end -- -- If extra warnings is specified, pump up the volume. @@ -91,6 +103,20 @@ ]] end +-- +-- If Everything is wanted, turn it ALL on +-- + + function suite.warningLevel_onEverythingWarnings() + warnings "Everything" + prepare() + test.capture [[ + + NotUsing + EnableAllWarnings + ]] + end + -- -- If the warnings are disabled, mute all warnings. -- @@ -105,6 +131,20 @@ ]] end +-- +-- Check default warning level. +-- + + function suite.warningLevel_onDefaultWarnings() + warnings "Default" + prepare() + test.capture [[ + + NotUsing + Level3 + ]] + end + -- -- If warnings are turned off, the fatal warnings flags should -- not be generated. diff --git a/modules/vstudio/vs200x_vcproj.lua b/modules/vstudio/vs200x_vcproj.lua index 735b66ddfb..81a3f9922f 100644 --- a/modules/vstudio/vs200x_vcproj.lua +++ b/modules/vstudio/vs200x_vcproj.lua @@ -1594,6 +1594,8 @@ local level if cfg.warnings == p.OFF then level = "0" + elseif cfg.warnings == "High" then + level = "4" elseif cfg.warnings == "Extra" then level = "4" elseif not filecfg then diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 193e3746d2..8d25b90492 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -2727,13 +2727,13 @@ function m.warningLevel(cfg) - local map = { Off = "TurnOffAllWarnings", Extra = "Level4" } + local map = { Off = "TurnOffAllWarnings", High = "Level4", Extra = "Level4", Everything = "EnableAllWarnings" } m.element("WarningLevel", nil, map[cfg.warnings] or "Level3") end function m.warningLevelFile(cfg, condition) - local map = { Off = "TurnOffAllWarnings", Extra = "Level4" } + local map = { Off = "TurnOffAllWarnings", High = "Level4", Extra = "Level4", Everything = "EnableAllWarnings" } if cfg.warnings then m.element("WarningLevel", condition, map[cfg.warnings] or "Level3") end diff --git a/modules/xcode/tests/test_xcode_project.lua b/modules/xcode/tests/test_xcode_project.lua index 858b0249e8..a1358f6cf2 100644 --- a/modules/xcode/tests/test_xcode_project.lua +++ b/modules/xcode/tests/test_xcode_project.lua @@ -2332,6 +2332,55 @@ ]] end + function suite.XCBuildConfigurationProject_OnNoWarnings() + warnings "Off" + prepare() + xcode.XCBuildConfiguration_Project(tr, tr.configs[1]) + test.capture [[ + A14350AC4595EE5E57CE36EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; + CONFIGURATION_TEMP_DIR = "$(OBJROOT)"; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OBJROOT = obj/Debug; + ONLY_ACTIVE_ARCH = NO; + SYMROOT = bin/Debug; + WARNING_CFLAGS = "-w"; + }; + name = Debug; + }; + ]] + end + + function suite.XCBuildConfigurationProject_OnHighWarnings() + warnings "High" + prepare() + xcode.XCBuildConfiguration_Project(tr, tr.configs[1]) + test.capture [[ + A14350AC4595EE5E57CE36EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; + CONFIGURATION_TEMP_DIR = "$(OBJROOT)"; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OBJROOT = obj/Debug; + ONLY_ACTIVE_ARCH = NO; + SYMROOT = bin/Debug; + WARNING_CFLAGS = "-Wall"; + }; + name = Debug; + }; + ]] + end function suite.XCBuildConfigurationProject_OnExtraWarnings() warnings "Extra" @@ -2359,6 +2408,32 @@ end + function suite.XCBuildConfigurationProject_OnEverythingWarnings() + warnings "Everything" + prepare() + xcode.XCBuildConfiguration_Project(tr, tr.configs[1]) + test.capture [[ + A14350AC4595EE5E57CE36EC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; + CONFIGURATION_TEMP_DIR = "$(OBJROOT)"; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OBJROOT = obj/Debug; + ONLY_ACTIVE_ARCH = NO; + SYMROOT = bin/Debug; + WARNING_CFLAGS = "-Weverything"; + }; + name = Debug; + }; + ]] + end + + function suite.XCBuildConfigurationProject_OnFatalWarnings() flags { "FatalWarnings" } prepare() diff --git a/modules/xcode/xcode_common.lua b/modules/xcode/xcode_common.lua index ef4e38fae8..481afb32a4 100644 --- a/modules/xcode/xcode_common.lua +++ b/modules/xcode/xcode_common.lua @@ -1450,8 +1450,14 @@ settings['SYMROOT'] = path.getrelative(tr.project.location, targetdir) end - if cfg.warnings == "Extra" then + if cfg.warnings == "Off" then + settings['WARNING_CFLAGS'] = '-w' + elseif cfg.warnings == "High" then + settings['WARNING_CFLAGS'] = '-Wall' + elseif cfg.warnings == "Extra" then settings['WARNING_CFLAGS'] = '-Wall -Wextra' + elseif cfg.warnings == "Everything" then + settings['WARNING_CFLAGS'] = '-Weverything' end overrideSettings(settings, cfg.xcodebuildsettings) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index a731f426f8..37496e60b9 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -1309,6 +1309,7 @@ "Default", "High", "Extra", + "Everything", } } diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 2087edd135..0cf7243b73 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -101,9 +101,10 @@ RDRND = "-mrdrnd", }, warnings = { - Extra = {"-Wall", "-Wextra"}, - High = "-Wall", Off = "-w", + High = "-Wall", + Extra = {"-Wall", "-Wextra"}, + Everything = "-Weverything", }, symbols = function(cfg, mappings) local values = gcc.getdebugformat(cfg) diff --git a/src/tools/msc.lua b/src/tools/msc.lua index 83a14f9af1..f0cf85b533 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -80,9 +80,10 @@ ["SSE4.1"] = "/arch:SSE2", }, warnings = { - Extra = "/W4", - High = "/W4", Off = "/W0", + High = "/W4", + Extra = "/W4", + Everything = "/Wall", }, staticruntime = { -- this option must always be emit (does it??) diff --git a/tests/tools/test_gcc.lua b/tests/tools/test_gcc.lua index 15146cd76a..bef18b01a8 100644 --- a/tests/tools/test_gcc.lua +++ b/tests/tools/test_gcc.lua @@ -74,18 +74,30 @@ -- Check the translation of CFLAGS. -- - function suite.cflags_onExtraWarnings() - warnings "extra" + function suite.cflags_onNoWarnings() + warnings "Off" prepare() - test.contains({ "-Wall", "-Wextra" }, gcc.getcflags(cfg)) + test.contains({ "-w" }, gcc.getcflags(cfg)) end function suite.cflags_onHighWarnings() - warnings "high" + warnings "High" prepare() test.contains({ "-Wall" }, gcc.getcflags(cfg)) end + function suite.cflags_onExtraWarnings() + warnings "Extra" + prepare() + test.contains({ "-Wall", "-Wextra" }, gcc.getcflags(cfg)) + end + + function suite.cflags_onEverythingWarnings() + warnings "Everything" + prepare() + test.contains({ "-Weverything" }, gcc.getcflags(cfg)) + end + function suite.cflags_onFatalWarnings() flags { "FatalWarnings" } prepare() @@ -112,12 +124,6 @@ test.contains({ "-ffloat-store" }, gcc.getcflags(cfg)) end - function suite.cflags_onNoWarnings() - warnings "Off" - prepare() - test.contains({ "-w" }, gcc.getcflags(cfg)) - end - function suite.cflags_onSSE() vectorextensions "SSE" prepare() diff --git a/tests/tools/test_msc.lua b/tests/tools/test_msc.lua index 341e0afb0e..1c245e97cb 100644 --- a/tests/tools/test_msc.lua +++ b/tests/tools/test_msc.lua @@ -224,6 +224,12 @@ test.contains("/W4", msc.getcflags(cfg)) end + function suite.cflags_OnEverythingWarnings() + warnings "Everything" + prepare() + test.contains("/Wall", msc.getcflags(cfg)) + end + function suite.cflags_OnFatalWarnings() flags "FatalWarnings" prepare()