typesign.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. static unsigned int * s_to_u_return(signed int *sp)
  2. {
  3. return sp;
  4. }
  5. static signed int * u_to_s_return(unsigned int *up)
  6. {
  7. return up;
  8. }
  9. static unsigned int * s_to_u_init(signed int *sp)
  10. {
  11. unsigned int *up = sp;
  12. return up;
  13. }
  14. static signed int * u_to_s_init(unsigned int *up)
  15. {
  16. signed int *sp = up;
  17. return sp;
  18. }
  19. static unsigned int * s_to_u_assign(signed int *sp)
  20. {
  21. unsigned int *up;
  22. up = sp;
  23. return up;
  24. }
  25. static signed int * u_to_s_assign(unsigned int *up)
  26. {
  27. signed int *sp;
  28. sp = up;
  29. return sp;
  30. }
  31. /*
  32. * check-name: -Wtypesign
  33. * check-command: sparse -Wtypesign $file
  34. *
  35. * check-error-start
  36. typesign.c:3:16: warning: incorrect type in return expression (different signedness)
  37. typesign.c:3:16: expected unsigned int *
  38. typesign.c:3:16: got signed int *sp
  39. typesign.c:8:16: warning: incorrect type in return expression (different signedness)
  40. typesign.c:8:16: expected signed int *
  41. typesign.c:8:16: got unsigned int *up
  42. typesign.c:13:28: warning: incorrect type in initializer (different signedness)
  43. typesign.c:13:28: expected unsigned int *up
  44. typesign.c:13:28: got signed int *sp
  45. typesign.c:19:26: warning: incorrect type in initializer (different signedness)
  46. typesign.c:19:26: expected signed int *sp
  47. typesign.c:19:26: got unsigned int *up
  48. typesign.c:26:12: warning: incorrect type in assignment (different signedness)
  49. typesign.c:26:12: expected unsigned int *up
  50. typesign.c:26:12: got signed int *sp
  51. typesign.c:33:12: warning: incorrect type in assignment (different signedness)
  52. typesign.c:33:12: expected signed int *sp
  53. typesign.c:33:12: got unsigned int *up
  54. * check-error-end
  55. */