function-redecl.c 4.3 KB

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