Skip to contentSkip to conversation

Annotate die() with noreturn

PATCH New Peter Foley 2 participants 2 messages Nov 26, 2016 – Nov 28, 2016 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Annotate die() with noreturn

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
---
 arch/x86/tools/relocs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/tools/relocs.h +1 -1
index f59590645b68..1d23bf953a4a 100644
@@ -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]))
 
Signature · 1 line
2.11.0.rc2
#1 lore raw

[tip:x86/urgent] x86/build: Annotate die() with noreturn to fix build warning on clang

x86/build: Annotate die() with noreturn to fix build warning on clang
Commit-ID:  adee8705d2517f0e163ffc45e8d7f9e97a58f1f6
Gitweb:     http://git.kernel.org/tip/adee8705d2517f0e163ffc45e8d7f9e97a58f1f6
Author:     Peter Foley <[email protected]>
AuthorDate: Sat, 26 Nov 2016 17:22:29 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Nov 2016 07:47:22 +0100

x86/build: Annotate die() with noreturn to fix build warning on clang

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]

---
 arch/x86/tools/relocs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/tools/relocs.h +1 -1
index f595906..1d23bf9 100644
@@ -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]))