[PATCH] D153163: Add __attribute__((warn_unused_result)) to LLVMErrorRef
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 04:54:38 PDT 2023
aaron.ballman added inline comments.
================
Comment at: llvm/include/llvm-c/ExternC.h:47-51
+#if LLVM_HAS_ATTRIBUTE(warn_unused_result) && defined(__clang__)
+#define LLVM_NODISCARD_GNU_STYLE_CLANG __attribute__((warn_unused_result))
+#else
+#define LLVM_NODISCARD_GNU_STYLE_CLANG
+#endif
----------------
dblaikie wrote:
> aaron.ballman wrote:
> > dblaikie wrote:
> > > aaron.ballman wrote:
> > > > Hmm, worth it to add `__has_c_attribute(nodiscard)` as a branch, or given C2x's newness, not worth it?
> > > Does C2x support the attribute on typedefs? (the C++ committee wasn't so enthusiastic about that change & I don't follow the C committee directly)
> > >
> > > I'm happy enough to include C support, if it applies.
> > Ah good point, it's not allowed on typedefs there either. Neeeevermind. :-)
> could rename the macro `WARN_UNUSED_RESULT` rather than `NODISCARD_GNU_STYLE`?
Hmmm, either seems about equally as confusing. What about `LLVM_NODISCARD_TYPEDEF` to make it clear that this should be used for typedefs and leave it to another macro to handle non-discardable function markings?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153163/new/
https://reviews.llvm.org/D153163
More information about the llvm-commits
mailing list