1 void f00(int _Atomic dst); 2 void f01(int _Atomic *dst); 3 void f02(int _Atomic *dst); 4 void f03(int _Atomic *dst); 5 6 int _Atomic qo; 7 int uo; 8 f00(int dst)9void f00(int dst) { } /* check-should-fail */ f01(typeof(& qo) dst)10void f01(typeof(&qo) dst) { } /* check-should-pass */ f02(int * dst)11void f02(int *dst) { } /* check-should-fail */ f03(typeof(& uo) dst)12void f03(typeof(&uo) dst) { } /* check-should-fail */ 13 foo(void)14void foo(void) 15 { 16 qo = uo; /* check-should-pass */ 17 uo = qo; /* check-should-pass */ 18 } 19 ref(void)20void ref(void) 21 { 22 const int qo; 23 int uo; 24 const int *pqo; 25 int *puo; 26 27 pqo = &qo; /* check-should-pass */ 28 pqo = &uo; /* check-should-pass */ 29 pqo = puo; /* check-should-pass */ 30 31 puo = &uo; /* check-should-pass */ 32 33 puo = &qo; /* check-should-fail */ 34 puo = pqo; /* check-should-fail */ 35 } 36 bar(void)37void bar(void) 38 { 39 int _Atomic *pqo; 40 int *puo; 41 42 pqo = &qo; /* check-should-pass */ 43 pqo = &uo; /* check-should-fail */ 44 pqo = puo; /* check-should-fail */ 45 46 puo = &uo; /* check-should-pass */ 47 48 puo = &qo; /* check-should-fail */ 49 puo = pqo; /* check-should-fail */ 50 } 51 baz(void)52void baz(void) 53 { 54 typeof(&qo) pqo; 55 typeof(&uo) puo; 56 57 pqo = &qo; /* check-should-pass */ 58 pqo = &uo; /* check-should-fail*/ 59 pqo = puo; /* check-should-fail */ 60 61 puo = &uo; /* check-should-pass */ 62 63 puo = &qo; /* check-should-fail */ 64 puo = pqo; /* check-should-fail */ 65 } 66 67 /* 68 * check-name: C11 _Atomic type qualifier 69 * check-command: sparse -Wno-decl $file 70 * 71 * check-error-start 72 c11-atomic.c:9:6: error: symbol 'f00' redeclared with different type (incompatible argument 1 (different modifiers)): 73 c11-atomic.c:9:6: void extern [addressable] [toplevel] f00( ... ) 74 c11-atomic.c:1:6: note: previously declared as: 75 c11-atomic.c:1:6: void extern [addressable] [toplevel] f00( ... ) 76 c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (incompatible argument 1 (different modifiers)): 77 c11-atomic.c:11:6: void extern [addressable] [toplevel] f02( ... ) 78 c11-atomic.c:3:6: note: previously declared as: 79 c11-atomic.c:3:6: void extern [addressable] [toplevel] f02( ... ) 80 c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (incompatible argument 1 (different modifiers)): 81 c11-atomic.c:12:6: void extern [addressable] [toplevel] f03( ... ) 82 c11-atomic.c:4:6: note: previously declared as: 83 c11-atomic.c:4:6: void extern [addressable] [toplevel] f03( ... ) 84 c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers) 85 c11-atomic.c:33:13: expected int *[assigned] puo 86 c11-atomic.c:33:13: got int const * 87 c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers) 88 c11-atomic.c:34:13: expected int *[assigned] puo 89 c11-atomic.c:34:13: got int const *[assigned] pqo 90 c11-atomic.c:43:13: warning: incorrect type in assignment (different modifiers) 91 c11-atomic.c:43:13: expected int [atomic] *[assigned] pqo 92 c11-atomic.c:43:13: got int * 93 c11-atomic.c:44:13: warning: incorrect type in assignment (different modifiers) 94 c11-atomic.c:44:13: expected int [atomic] *[assigned] pqo 95 c11-atomic.c:44:13: got int *puo 96 c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers) 97 c11-atomic.c:48:13: expected int *[assigned] puo 98 c11-atomic.c:48:13: got int [atomic] * 99 c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers) 100 c11-atomic.c:49:13: expected int *[assigned] puo 101 c11-atomic.c:49:13: got int [atomic] *[assigned] pqo 102 c11-atomic.c:58:13: warning: incorrect type in assignment (different modifiers) 103 c11-atomic.c:58:13: expected int [atomic] *[assigned] pqo 104 c11-atomic.c:58:13: got int * 105 c11-atomic.c:59:13: warning: incorrect type in assignment (different modifiers) 106 c11-atomic.c:59:13: expected int [atomic] *[assigned] pqo 107 c11-atomic.c:59:13: got int *puo 108 c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers) 109 c11-atomic.c:63:13: expected int *[assigned] puo 110 c11-atomic.c:63:13: got int [atomic] * 111 c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers) 112 c11-atomic.c:64:13: expected int *[assigned] puo 113 c11-atomic.c:64:13: got int [atomic] *[assigned] pqo 114 * check-error-end 115 */ 116