Skip to content

disablewarnings is not handled correctly in visual studio with clang-cl #2788

Description

@luxploit

What seems to be the problem?
When using toolset "clang", which will use clang-cl under VS, Premake incorrectly generates the arguments for disablewarnings. It generates with -Wno-[number] instead of /wd[number], which are only supported in clang-cl for clang specific options via the /clang: flag (eg. /clang:-Wno-c99-designator).

Seems to been introduced in this PR here: #2529

What did you expect to happen?
It should have generated: /wd28251 /wd4996 /wd4800 for the input disablewarnings { "28251", "4996", "4800" }, but instead generates -Wno-28251 -Wno-4996 -Wno-4800

Currently the workaround involves issuing the correct option via buildoptions like so:

filter "toolset:clang"
	buildoptions { "/wd28251", "/wd4996", "/wd4800" }
filter {}

Minimal example:

premake5.lua

workspace "test"
configurations { "Debug" }
platforms { "x64" }

filter "configurations:Debug"
	defines { "_DEBUG" }
	symbols "On"
filter {}

enablepch "Off"
multiprocessorcompile "On"

disablewarnings { "28251", "4996", "4800" }

project "testapp1"
	location "src"
	kind "ConsoleApp"
	toolset "clang"
	files { "src/**.hpp", "src/**.cpp" }

main.cpp

#include <stdio.h>

int main() {
   printf("hallo :)");
   return 0;
}

Tested with:

  • Visual Studio 2026 (vs2026)
  • Visual Studio 2022 (vs2022)

What version of Premake are you using?

PS C:\Users\Laura> premake5 --version
premake5 (Premake Build Script Generator) 5.0.0-beta8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions