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