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