Skip to contentSkip to conversation

fix warnings when using _syscall# macros from unistd.h to declare void functions

parisc-linux Mike Frysinger 1 participant 1 message Nov 16, 2005 4 messages not in the archive Kbuild

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · Mike Frysinger
Quoted 4 lines · Matthew Wilcox
Quoted 3 lines · Mike Frysinger

if you try to declare a void function using the _syscall macros provided by asm-parisc/unistd.h, you'll get warnings about trying to return from a non-void function ... i386 fixes this by typecasting

Quoted 5 lines
Quoted 2 lines

i noticed though when trying to do mmap:
mmap.c:16: warning: return makes pointer from integer without a cast

If you'd posted that example, I don't think I would have blinked ;-) Send a patch please ;-)

yeah sorry, i saw a warning and didnt really read it ... when i glanced in the file i picked out the issue pretty quickly and hadnt tried to reproduce again ... /me smacks self
-mike

libc/sysdeps/linux/hppa/bits/syscalls.h renamed from usr/src/linux-2.6.git/include/asm-parisc/unistd.h +7 -7
@@ -875,38 +875,38 @@
 #define _syscall0(type,name)						\
 type name(void)								\
 {									\
-    return K_INLINE_SYSCALL(name, 0);	                                \
+    return (type) K_INLINE_SYSCALL(name, 0);	                                \
 }
 
 #define _syscall1(type,name,type1,arg1)					\
 type name(type1 arg1)							\
 {									\
-    return K_INLINE_SYSCALL(name, 1, arg1);	                        \
+    return (type) K_INLINE_SYSCALL(name, 1, arg1);	                        \
 }
 
 #define _syscall2(type,name,type1,arg1,type2,arg2)			\
 type name(type1 arg1, type2 arg2)					\
 {									\
-    return K_INLINE_SYSCALL(name, 2, arg1, arg2);	                \
+    return (type) K_INLINE_SYSCALL(name, 2, arg1, arg2);	                \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)		\
 type name(type1 arg1, type2 arg2, type3 arg3)				\
 {									\
-    return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3);	                \
+    return (type) K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3);	                \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4)		\
 {									\
-    return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4);	        \
+    return (type) K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4);	        \
 }
 
 /* select takes 5 arguments */
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)	\
 {									\
-    return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5);	\
+    return (type) K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5);	\
 }
 
 #ifdef __KERNEL__
@@ -937,7 +937,7 @@
 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
 {									        \
-    return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
+    return (type) K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
 
 #ifdef __KERNEL_SYSCALLS__

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux