[PATCH] D153163: Add __attribute__((warn_unused_result)) to LLVMErrorRef
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 08:17:27 PDT 2023
lhames added a comment.
Adding warn-unused attribute(s) either to `LLVMErrorRef` (if possible) or to the individual APIs seems like a great idea to me. No opinion on the mechanics -- I don't know anything about the relevant C attributes.
================
Comment at: llvm/examples/OrcV2Examples/OrcV2CBindingsLazy/OrcV2CBindingsLazy.c:198
LLVMOrcLazyReexports(LCTM, ISM, MainJD, ReExports, 2);
- LLVMOrcJITDylibDefine(MainJD, MU);
+ (void)LLVMOrcJITDylibDefine(MainJD, MU);
}
----------------
aaron.ballman wrote:
> 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?
The return type is appropriate, I've just been lazy about checking it -- adding warn-unused seems like a big win for that reason. :)
Rather than casting to void I should add an `LLVMCantFail` macro that asserts that the result is `LLVMErrorSuccess`.
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