1 #define __user __attribute__((address_space(1))) 2 #define NULL ((void*)0) 3 4 int ret_type(void); ret_type(void)5void ret_type(void) { } /* check-should-fail */ 6 7 8 int ret_const(void); ret_const(void)9int const ret_const(void) { return 0; } /* check-should-fail */ 10 11 12 void *ret_as(void); ret_as(void)13void __user *ret_as(void) { return NULL; } /* check-should-fail */ 14 15 16 void *ret_mod(void); ret_mod(void)17void const *ret_mod(void) { return NULL; } /* check-should-fail */ 18 19 20 void arg_type(int a); arg_type(void * a)21void arg_type(void *a) { } /* check-should-fail */ 22 23 24 void arg_const(int a); arg_const(const int a)25void arg_const(const int a) { } /* OK */ 26 27 28 void arg_as(void *a); arg_as(void __user * a)29void arg_as(void __user *a) { } /* check-should-fail */ 30 31 32 void arg_mod(void *); arg_mod(void const * a)33void arg_mod(void const *a) { } /* check-should-fail */ 34 35 36 void arg_more_arg(int a); arg_more_arg(int a,int b)37void arg_more_arg(int a, int b) { } /* check-should-fail */ 38 39 40 void arg_less_arg(int a, int b); arg_less_arg(int a)41void arg_less_arg(int a) { } /* check-should-fail */ 42 43 44 void arg_vararg(int a); arg_vararg(int a,...)45void arg_vararg(int a, ...) { } /* check-should-fail */ 46 47 /* 48 * check-name: function-redecl 49 * 50 * check-error-start 51 function-redecl.c:5:6: error: symbol 'ret_type' redeclared with different type (different base types): 52 function-redecl.c:5:6: void extern [addressable] [toplevel] ret_type( ... ) 53 function-redecl.c:4:5: note: previously declared as: 54 function-redecl.c:4:5: int extern [addressable] [signed] [toplevel] ret_type( ... ) 55 function-redecl.c:9:11: error: symbol 'ret_const' redeclared with different type (different modifiers): 56 function-redecl.c:9:11: int extern const [addressable] [signed] [toplevel] ret_const( ... ) 57 function-redecl.c:8:5: note: previously declared as: 58 function-redecl.c:8:5: int extern [addressable] [signed] [toplevel] ret_const( ... ) 59 function-redecl.c:13:13: error: symbol 'ret_as' redeclared with different type (different address spaces): 60 function-redecl.c:13:13: void <asn:1> *extern [addressable] [toplevel] ret_as( ... ) 61 function-redecl.c:12:6: note: previously declared as: 62 function-redecl.c:12:6: void *extern [addressable] [toplevel] ret_as( ... ) 63 function-redecl.c:17:12: error: symbol 'ret_mod' redeclared with different type (different modifiers): 64 function-redecl.c:17:12: void const *extern [addressable] [toplevel] ret_mod( ... ) 65 function-redecl.c:16:6: note: previously declared as: 66 function-redecl.c:16:6: void *extern [addressable] [toplevel] ret_mod( ... ) 67 function-redecl.c:21:6: error: symbol 'arg_type' redeclared with different type (incompatible argument 1 (different base types)): 68 function-redecl.c:21:6: void extern [addressable] [toplevel] arg_type( ... ) 69 function-redecl.c:20:6: note: previously declared as: 70 function-redecl.c:20:6: void extern [addressable] [toplevel] arg_type( ... ) 71 function-redecl.c:29:6: error: symbol 'arg_as' redeclared with different type (incompatible argument 1 (different address spaces)): 72 function-redecl.c:29:6: void extern [addressable] [toplevel] arg_as( ... ) 73 function-redecl.c:28:6: note: previously declared as: 74 function-redecl.c:28:6: void extern [addressable] [toplevel] arg_as( ... ) 75 function-redecl.c:33:6: error: symbol 'arg_mod' redeclared with different type (incompatible argument 1 (different modifiers)): 76 function-redecl.c:33:6: void extern [addressable] [toplevel] arg_mod( ... ) 77 function-redecl.c:32:6: note: previously declared as: 78 function-redecl.c:32:6: void extern [addressable] [toplevel] arg_mod( ... ) 79 function-redecl.c:37:6: error: symbol 'arg_more_arg' redeclared with different type (different argument counts): 80 function-redecl.c:37:6: void extern [addressable] [toplevel] arg_more_arg( ... ) 81 function-redecl.c:36:6: note: previously declared as: 82 function-redecl.c:36:6: void extern [addressable] [toplevel] arg_more_arg( ... ) 83 function-redecl.c:41:6: error: symbol 'arg_less_arg' redeclared with different type (different argument counts): 84 function-redecl.c:41:6: void extern [addressable] [toplevel] arg_less_arg( ... ) 85 function-redecl.c:40:6: note: previously declared as: 86 function-redecl.c:40:6: void extern [addressable] [toplevel] arg_less_arg( ... ) 87 function-redecl.c:45:6: error: symbol 'arg_vararg' redeclared with different type (incompatible variadic arguments): 88 function-redecl.c:45:6: void extern [addressable] [toplevel] arg_vararg( ... ) 89 function-redecl.c:44:6: note: previously declared as: 90 function-redecl.c:44:6: void extern [addressable] [toplevel] arg_vararg( ... ) 91 * check-error-end 92 */ 93