[PATCH 1/4] cli: add noreturn attributes
Peter Wu
peter at lekensteyn.nl
Mon Aug 8 02:58:50 PDT 2016
Teach static code analyzers (such as Clang static analyzer) that code
following nl_cli_fatal can never be executed. Avoids false positives
such as detecting use of NULL pointers when that cannot happen.
Signed-off-by: Peter Wu <peter at lekensteyn.nl>
---
include/netlink/cli/utils.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/netlink/cli/utils.h b/include/netlink/cli/utils.h
index ea89fc6..4c28343 100644
--- a/include/netlink/cli/utils.h
+++ b/include/netlink/cli/utils.h
@@ -61,8 +61,10 @@ extern "C" {
#endif
extern uint32_t nl_cli_parse_u32(const char *);
-extern void nl_cli_print_version(void);
-extern void nl_cli_fatal(int, const char *, ...);
+extern void nl_cli_print_version(void)
+ __attribute__((noreturn));
+extern void nl_cli_fatal(int, const char *, ...)
+ __attribute__((noreturn));
extern struct nl_addr * nl_cli_addr_parse(const char *, int);
extern int nl_cli_connect(struct nl_sock *, int);
extern struct nl_sock * nl_cli_alloc_socket(void);
--
2.9.2
More information about the libnl
mailing list