aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-07-11 12:47:45 -0400
committerMatt Turner <mattst88@gmail.com>2013-11-16 19:33:09 -0500
commita47e5bb5764f029f989a182b0dd2d4cce69f8b14 (patch)
treed2abfd2919b84ab3917303f5683e982be09f8568 /arch/alpha
parent673fdfe3f0630b03f3854d0361b1232f2e5ef7fb (diff)
alpha: Eliminate compiler warning from memset macro
Compiling with GCC 4.8 yields several instances of crypto/vmac.c: In function ‘vmac_final’: crypto/vmac.c:616:9: warning: value computed is not used [-Wunused-value] memset(&mac, 0, sizeof(vmac_t)); ^ arch/alpha/include/asm/string.h:31:25: note: in definition of macro ‘memset’ ? __builtin_memset((s),0,(n)) \ ^ Converting the macro to an inline function eliminates this problem. However, doing only that causes problems with the GCC 3.x series. The inline function cannot be named "memset", as otherwise we wind up with recursion via __builtin_memset. Solve this by adjusting the symbols such that __memset is the inline, and ___memset is the real function. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/include/asm/string.h24
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c1
-rw-r--r--arch/alpha/lib/ev6-memset.S12
-rw-r--r--arch/alpha/lib/memset.S11
4 files changed, 33 insertions, 15 deletions
diff --git a/arch/alpha/include/asm/string.h b/arch/alpha/include/asm/string.h
index b02b8a282940..c2911f591704 100644
--- a/arch/alpha/include/asm/string.h
+++ b/arch/alpha/include/asm/string.h
@@ -22,15 +22,27 @@ extern void * __memcpy(void *, const void *, size_t);
22 22
23#define __HAVE_ARCH_MEMSET 23#define __HAVE_ARCH_MEMSET
24extern void * __constant_c_memset(void *, unsigned long, size_t); 24extern void * __constant_c_memset(void *, unsigned long, size_t);
25extern void * ___memset(void *, int, size_t);
25extern void * __memset(void *, int, size_t); 26extern void * __memset(void *, int, size_t);
26extern void * memset(void *, int, size_t); 27extern void * memset(void *, int, size_t);
27 28
28#define memset(s, c, n) \ 29/* For gcc 3.x, we cannot have the inline function named "memset" because
29(__builtin_constant_p(c) \ 30 the __builtin_memset will attempt to resolve to the inline as well,
30 ? (__builtin_constant_p(n) && (c) == 0 \ 31 leading to a "sorry" about unimplemented recursive inlining. */
31 ? __builtin_memset((s),0,(n)) \ 32extern inline void *__memset(void *s, int c, size_t n)
32 : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \ 33{
33 : __memset((s),(c),(n))) 34 if (__builtin_constant_p(c)) {
35 if (__builtin_constant_p(n)) {
36 return __builtin_memset(s, c, n);
37 } else {
38 unsigned long c8 = (c & 0xff) * 0x0101010101010101UL;
39 return __constant_c_memset(s, c8, n);
40 }
41 }
42 return ___memset(s, c, n);
43}
44
45#define memset __memset
34 46
35#define __HAVE_ARCH_STRCPY 47#define __HAVE_ARCH_STRCPY
36extern char * strcpy(char *,const char *); 48extern char * strcpy(char *,const char *);
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index 89566b346c0f..f4c7ab6f43b0 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -40,6 +40,7 @@ EXPORT_SYMBOL(strrchr);
40EXPORT_SYMBOL(memmove); 40EXPORT_SYMBOL(memmove);
41EXPORT_SYMBOL(__memcpy); 41EXPORT_SYMBOL(__memcpy);
42EXPORT_SYMBOL(__memset); 42EXPORT_SYMBOL(__memset);
43EXPORT_SYMBOL(___memset);
43EXPORT_SYMBOL(__memsetw); 44EXPORT_SYMBOL(__memsetw);
44EXPORT_SYMBOL(__constant_c_memset); 45EXPORT_SYMBOL(__constant_c_memset);
45EXPORT_SYMBOL(copy_page); 46EXPORT_SYMBOL(copy_page);
diff --git a/arch/alpha/lib/ev6-memset.S b/arch/alpha/lib/ev6-memset.S
index d8b94e1c7fca..356bb2fdd705 100644
--- a/arch/alpha/lib/ev6-memset.S
+++ b/arch/alpha/lib/ev6-memset.S
@@ -30,14 +30,15 @@
30 .set noat 30 .set noat
31 .set noreorder 31 .set noreorder
32.text 32.text
33 .globl memset
33 .globl __memset 34 .globl __memset
35 .globl ___memset
34 .globl __memsetw 36 .globl __memsetw
35 .globl __constant_c_memset 37 .globl __constant_c_memset
36 .globl memset
37 38
38 .ent __memset 39 .ent ___memset
39.align 5 40.align 5
40__memset: 41___memset:
41 .frame $30,0,$26,0 42 .frame $30,0,$26,0
42 .prologue 0 43 .prologue 0
43 44
@@ -227,7 +228,7 @@ end_b:
227 nop 228 nop
228 nop 229 nop
229 ret $31,($26),1 # L0 : 230 ret $31,($26),1 # L0 :
230 .end __memset 231 .end ___memset
231 232
232 /* 233 /*
233 * This is the original body of code, prior to replication and 234 * This is the original body of code, prior to replication and
@@ -594,4 +595,5 @@ end_w:
594 595
595 .end __memsetw 596 .end __memsetw
596 597
597memset = __memset 598memset = ___memset
599__memset = ___memset
diff --git a/arch/alpha/lib/memset.S b/arch/alpha/lib/memset.S
index 311b8cfc6914..76ccc6d1f364 100644
--- a/arch/alpha/lib/memset.S
+++ b/arch/alpha/lib/memset.S
@@ -19,11 +19,13 @@
19.text 19.text
20 .globl memset 20 .globl memset
21 .globl __memset 21 .globl __memset
22 .globl ___memset
22 .globl __memsetw 23 .globl __memsetw
23 .globl __constant_c_memset 24 .globl __constant_c_memset
24 .ent __memset 25
26 .ent ___memset
25.align 5 27.align 5
26__memset: 28___memset:
27 .frame $30,0,$26,0 29 .frame $30,0,$26,0
28 .prologue 0 30 .prologue 0
29 31
@@ -103,7 +105,7 @@ within_one_quad:
103 105
104end: 106end:
105 ret $31,($26),1 /* E1 */ 107 ret $31,($26),1 /* E1 */
106 .end __memset 108 .end ___memset
107 109
108 .align 5 110 .align 5
109 .ent __memsetw 111 .ent __memsetw
@@ -121,4 +123,5 @@ __memsetw:
121 123
122 .end __memsetw 124 .end __memsetw
123 125
124memset = __memset 126memset = ___memset
127__memset = ___memset