[Mlir-commits] [llvm] [mlir] eliminating g++ warnings (PR #105520)

David Blaikie llvmlistbot at llvm.org
Thu Aug 22 09:59:01 PDT 2024


================
@@ -301,7 +301,7 @@ void mlirDebuggerAddFileLineColLocBreakpoint(const char *file, int line,
 
 LLVM_ATTRIBUTE_NOINLINE void mlirDebuggerBreakpointHook() {
   static LLVM_THREAD_LOCAL void *volatile sink;
-  sink = (void *)&sink;
+  sink = (void *)const_cast<void **>(&sink);
----------------
dwblaikie wrote:

A warning? Again, could ignore the warning if clang doesn't catch it and it doesn't seem to be adding value?

Though technically the LLVM style guide does say to prefer C++ style casts over C style ones, I think? So perhaps we could lean into that and replace this with two C++ casts, rather than a C and a C++ one?

https://github.com/llvm/llvm-project/pull/105520


More information about the Mlir-commits mailing list