[Lldb-commits] [lldb] [LLDB] Silence warnings when building on Windows (PR #191566)

Alexandre Ganea via lldb-commits lldb-commits at lists.llvm.org
Sat Apr 11 16:32:11 PDT 2026


================
@@ -36,6 +36,7 @@ std::string lldb_private::CreateFile(llvm::StringRef filename,
   int fd;
   std::error_code ret = llvm::sys::fs::openFileForWrite(path, fd);
   assert(!ret && "Failed to create test file.");
+  (void)ret;
----------------
aganea wrote:

> Hmm, weird. But fair enough, thanks for trying.

So `[[maybe_unused]]` is only a decl attribute, not a statement attribute. So we could write this:
```
  [[maybe_unused]] std::error_code ret = llvm::sys::fs::openFileForWrite(path, fd);
  assert(!ret && "Failed to create test file.");
  ret;
```
But I agree if we had ` [[maybe_unused]]` as a statement attribute it'd nicer, clearly show the intent ("here we throw away the result of the evaluation on intent"). The (void) cast is just a hack because we don't have that attribute suppose.

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


More information about the lldb-commits mailing list