Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530788

[PATCH] Annotate die() with noreturn

From Peter Foley <pefoley2@pefoley.com>
Newsgroups linux.kernel
Subject [PATCH] Annotate die() with noreturn
Date 2016-11-26 23:30 +0100
Message-ID <sHTDQ-47v-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Fixes below warning with clang:

In file included from ../arch/x86/tools/relocs_64.c:17:                                                                                               ../arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]             if (!use_real_mode)
            ^~~~~~~~~~~~~~                                                                                                                            ../arch/x86/tools/relocs.c:989:14: note: uninitialized use occurs here                                                                                        walk_relocs(do_reloc);                                                                                                                                            ^~~~~~~~                                                                                                                          ../arch/x86/tools/relocs.c:977:2: note: remove the 'if' if its condition is always true
        if (!use_real_mode)
        ^~~~~~~~~~~~~~~~~~~
../arch/x86/tools/relocs.c:974:24: note: initialize the variable 'do_reloc' to silence this warning
                        const char *symname);
                                            ^
                                             = NULL

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 arch/x86/tools/relocs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/tools/relocs.h b/arch/x86/tools/relocs.h
index f59590645b68..1d23bf953a4a 100644
--- a/arch/x86/tools/relocs.h
+++ b/arch/x86/tools/relocs.h
@@ -16,7 +16,7 @@
 #include <regex.h>
 #include <tools/le_byteshift.h>
 
-void die(char *fmt, ...);
+void die(char *fmt, ...) __attribute__((noreturn));
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
-- 
2.11.0.rc2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Annotate die() with noreturn Peter Foley <pefoley2@pefoley.com> - 2016-11-26 23:30 +0100
  [tip:x86/urgent] x86/build: Annotate die() with noreturn to fix  build warning on clang tip-bot for Peter Foley <tipbot@zytor.com> - 2016-11-28 08:30 +0100

csiph-web