Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/22504 )
Change subject: [util] add 'nodiscard' attribute for Status ...................................................................... [util] add 'nodiscard' attribute for Status This patch helps to spot sloppy error handling and catch related mistakes and bugs at compile time once Status class is marked with the 'nodiscard' attribute [1]. It has a potential of saving us time doing debugging and troubleshooting, at least I know a few occasions where it should have helped :) With this patch, a non-handled result Status produces a compiler's warning when compiling with CLANG or GCC13 and newer. People developing on macOS and Ubuntu 24.04 can see that with this patch, and our ASAN and TSAN pre-commit builds should produce corresponding warnings as well. A follow-up changelist [2] turns warnings into errors. Once the sloppiness in error handling is addressed throughout the existing code, [2] should be added to guard against sloppy error handling in newly added code. [1] https://en.cppreference.com/w/cpp/language/attributes/nodiscard [2] https://gerrit.cloudera.org/#/c/22489/ Change-Id: I1ec324e3bb5d10bc35f34ed2614e239a4a150446 Reviewed-on: http://gerrit.cloudera.org:8080/22504 Reviewed-by: Abhishek Chennaka <[email protected]> Tested-by: Alexey Serbin <[email protected]> --- M src/kudu/util/status.h 1 file changed, 19 insertions(+), 1 deletion(-) Approvals: Abhishek Chennaka: Looks good to me, approved Alexey Serbin: Verified -- To view, visit http://gerrit.cloudera.org:8080/22504 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I1ec324e3bb5d10bc35f34ed2614e239a4a150446 Gerrit-Change-Number: 22504 Gerrit-PatchSet: 3 Gerrit-Owner: Alexey Serbin <[email protected]> Gerrit-Reviewer: Abhishek Chennaka <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Attila Bukor <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Yifan Zhang <[email protected]> Gerrit-Reviewer: Zoltan Martonka <[email protected]>
