[lld] [lld] Replace LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]] (NFC) (PR #163701)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 22:38:43 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-macho
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch replaces LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]],
introduced as part of C++17.
---
Full diff: https://github.com/llvm/llvm-project/pull/163701.diff
2 Files Affected:
- (modified) lld/ELF/Symbols.cpp (+1-1)
- (modified) lld/MachO/Driver.cpp (+1-1)
``````````diff
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index de839795c50d7..220ec99c22e6f 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -35,7 +35,7 @@ template <typename T> struct AssertSymbol {
"SymbolUnion not aligned enough");
};
-LLVM_ATTRIBUTE_UNUSED static inline void assertSymbols() {
+[[maybe_unused]] static inline void assertSymbols() {
AssertSymbol<Defined>();
AssertSymbol<CommonSymbol>();
AssertSymbol<Undefined>();
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 94f441b7643a7..bfd35aef72b58 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -355,7 +355,7 @@ void multiThreadedPageInBackground(DeferredFiles &deferred) {
// Reference all file's mmap'd pages to load them into memory.
for (const char *page = buff.data(), *end = page + buff.size(); page < end;
page += pageSize) {
- LLVM_ATTRIBUTE_UNUSED volatile char t = *page;
+ [[maybe_unused]] volatile char t = *page;
(void)t;
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/163701
More information about the llvm-commits
mailing list