Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

We recently moved over to compiling with clang-cl on Windows. This ended
up causing a large increase in warnings, particularly due to how
warnings are handled in nanobind. cd91d0f
initially set -Wall -Wextra and -Wpedantic while fixing another issue,
which is probably not what we want to do on third-party code. We also
need to disable -Wmissing-field-initializers to get things clean in this
configuration.

@boomanaiden154 boomanaiden154 requested review from jpienaar and makslevental and removed request for jpienaar November 6, 2025 19:05
@llvmbot llvmbot added the mlir label Nov 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 6, 2025

@llvm/pr-subscribers-mlir

Author: Aiden Grossman (boomanaiden154)

Changes

We recently moved over to compiling with clang-cl on Windows. This ended
up causing a large increase in warnings, particularly due to how
warnings are handled in nanobind. cd91d0f
initially set -Wall -Wextra and -Wpedantic while fixing another issue,
which is probably not what we want to do on third-party code. We also
need to disable -Wmissing-field-initializers to get things clean in this
configuration.


Full diff: https://github.com/llvm/llvm-project/pull/166828.diff

1 Files Affected:

  • (modified) mlir/cmake/modules/AddMLIRPython.cmake (+2-2)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index fa6aec8a603a9..8196e2a2a3321 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -791,7 +791,6 @@ function(add_mlir_python_extension libname extname)
       get_property(NB_LIBRARY_TARGET_NAME TARGET ${libname} PROPERTY LINK_LIBRARIES)
       target_compile_options(${NB_LIBRARY_TARGET_NAME}
         PRIVATE
-          -Wall -Wextra -Wpedantic
           -Wno-c++98-compat-extra-semi
           -Wno-cast-qual
           -Wno-covered-switch-default
@@ -799,11 +798,11 @@ function(add_mlir_python_extension libname extname)
           -Wno-nested-anon-types
           -Wno-unused-parameter
           -Wno-zero-length-array
+          -Wno-missing-field-initializers
           ${eh_rtti_enable})
 
       target_compile_options(${libname}
         PRIVATE
-          -Wall -Wextra -Wpedantic
           -Wno-c++98-compat-extra-semi
           -Wno-cast-qual
           -Wno-covered-switch-default
@@ -811,6 +810,7 @@ function(add_mlir_python_extension libname extname)
           -Wno-nested-anon-types
           -Wno-unused-parameter
           -Wno-zero-length-array
+          -Wno-missing-field-initializers
           ${eh_rtti_enable})
     endif()
 

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Nov 6, 2025
We recently moved over to compiling with clang-cl on Windows. This ended
up causing a large increase in warnings, particularly due to how
warnings are handled in nanobind. cd91d0f
initially set -Wall -Wextra and -Wpedantic while fixing another issue,
which is probably not what we want to do on third-party code. We also
need to disable -Wmissing-field-initializers to get things clean in this
configuration.

Pull Request: llvm#166828
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Nov 6, 2025
We recently moved over to compiling with clang-cl on Windows. This ended
up causing a large increase in warnings, particularly due to how
warnings are handled in nanobind. cd91d0f
initially set -Wall -Wextra and -Wpedantic while fixing another issue,
which is probably not what we want to do on third-party code. We also
need to disable -Wmissing-field-initializers to get things clean in this
configuration.

Pull Request: llvm#166828
Copy link
Contributor

@makslevental makslevental left a comment

Choose a reason for hiding this comment

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

This thing is a perennial PITA. I'm stamping to unblock but can you can also try NB_SUPPRESS_WARNINGS.

@makslevental
Copy link
Contributor

PS also this wjakob/nanobind#994 🙂

@boomanaiden154
Copy link
Contributor Author

This thing is a perennial PITA. I'm stamping to unblock but can you can also try wjakob/nanobind#868.

Yeah, looks like it. Very interesting to see a project that is pretty against disabling warnings, but also against accepting patches to fix warnings that do come up. I'll land this as is and see if I can get NB_SUPPRESS_WARNINGS to eliminate the need for the custom compile options.

Created using spr 1.3.7

[skip ci]
Created using spr 1.3.7
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.mlirpython-update-nanobind-warnings-list-for-clang-cl-on-windows to main November 6, 2025 20:09
@boomanaiden154 boomanaiden154 merged commit e5ba3c6 into main Nov 6, 2025
6 of 11 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/mlirpython-update-nanobind-warnings-list-for-clang-cl-on-windows branch November 6, 2025 20:10
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 6, 2025
…on Windows

We recently moved over to compiling with clang-cl on Windows. This ended
up causing a large increase in warnings, particularly due to how
warnings are handled in nanobind. cd91d0f
initially set -Wall -Wextra and -Wpedantic while fixing another issue,
which is probably not what we want to do on third-party code. We also
need to disable -Wmissing-field-initializers to get things clean in this
configuration.

Reviewers: makslevental, jpienaar, rkayaith

Reviewed By: makslevental

Pull Request: llvm/llvm-project#166828
@jpienaar
Copy link
Member

jpienaar commented Nov 6, 2025

Thanks!

@boomanaiden154
Copy link
Contributor Author

It looks like the option in wjakob/nanobind#868 does not actually fix the issue. We still get warnings when building the nanobind objects that compose the static lib, which it doesn't seem like that patch actually addresses. So I think we'll need this logic to manually set additional compile options for now.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants