[PATCH] D153163: Add __attribute__((warn_unused_result)) to LLVMErrorRef

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 18 05:07:33 PDT 2023


aaron.ballman added inline comments.


================
Comment at: llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/OrcV2CBindingsLazy.c:198
         LLVMOrcLazyReexports(LCTM, ISM, MainJD, ReExports, 2);
-    LLVMOrcJITDylibDefine(MainJD, MU);
+    (void)LLVMOrcJITDylibDefine(MainJD, MU);
   }
----------------
Keep in mind, I know nothing about Orc. :-D

It seems that the only in-tree uses of this API that check results are the unit tests. Perhaps this function's return type is inappropriate? Or does this suggest we should be marking individual APIs instead of the return type itself?


================
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
----------------
Hmm, worth it to add `__has_c_attribute(nodiscard)` as a branch, or given C2x's newness, not worth it?


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