]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Linux: Fix AFS_NORETURN violation with osi_AssertFailK
authorAnders Kaseorg <andersk@mit.edu>
Sat, 6 Nov 2010 07:03:19 +0000 (03:03 -0400)
committerDerrick Brashear <shadow@dementia.org>
Tue, 14 Dec 2010 04:54:46 +0000 (20:54 -0800)
Commit d86f0c44d3c5910a6b54895484dc0286eac9bc73 changed the
AFS_LINUX26_ENV implementation of osi_AssertFailK so that it returns,
contradicting its AFS_NORETURN prototype, in an effort to make the
following BUG() display the right line number.  To fix this, move the
returning implementation into its only caller, the osi_Assert macro.

This fixes possible compiler misoptimizations due to

rx_kcommon.c:255:1: warning: ‘noreturn’ function does return

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3276
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 1519144f83925d82117f31ce0872f77660f197ee)

Change-Id: I2b630a3264d04d6fbb626b7ef997da9bf081ade1
Reviewed-on: http://gerrit.openafs.org/3513
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/rx/rx_kcommon.c
src/rx/rx_prototypes.h

index bd452a7b2bdb780a13c2b47bf30e84bae492c8d1..1bef5f1ea6c241c98e6610e2af1df022a0112d92 100644 (file)
@@ -245,12 +245,6 @@ osi_AssertFailK(const char *expr, const char *file, int line)
 
     osi_Panic("%s", buf);
 }
-#else
-void
-osi_AssertFailK(const char *expr, const char *file, int line)
-{
-    printk(KERN_CRIT "assertion failed: %s, file: %s, line: %d\n", expr, file, line);
-}
 #endif
 
 #ifndef UKERNEL
index 241837aaa9bd3265d50b7bfd95db8ec986f789d2..52bbf6d12b93d1fe42d32a862b1dc6ee7f6d3c78 100644 (file)
@@ -384,7 +384,7 @@ extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
 # define osi_Panic(msg...) do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0)
 # undef osi_Assert
 # define osi_Assert(expr) \
-    do { if (!(expr)) { osi_AssertFailK(#expr, __FILE__, __LINE__); BUG(); } } while (0)
+    do { if (!(expr)) osi_Panic("assertion failed: %s, file: %s, line: %d\n", #expr, __FILE__, __LINE__); } while (0)
 # elif defined(AFS_AIX_ENV)
 extern void osi_Panic(char *fmt, void *a1, void *a2, void *a3);
 # else
@@ -410,7 +410,9 @@ extern int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host,
 # ifdef UKERNEL
 extern void *rx_ServerProc(void *);
 # endif
+# ifndef AFS_LINUX26_ENV
 extern void osi_AssertFailK(const char *expr, const char *file, int line) AFS_NORETURN;
+# endif
 extern void rxk_ListenerProc(void);
 extern void rxk_Listener(void);
 # ifndef UKERNEL