1#define __user __attribute__((address_space(1))) 2#define __noderef __attribute__((noderef)) 3#define __bitwise __attribute__((bitwise)) 4#define __nocast __attribute__((nocast)) 5#define __safe __attribute__((safe)) 6 7 8/* Should be inherited? */ 9static void test_const(void) 10{ 11 const int o; 12 int *p = &o; /* check-should-fail */ 13} 14 15static void test_volatile(void) 16{ 17 volatile int o; 18 int *p = &o; /* check-should-fail */ 19} 20 21static void test_noderef(void) 22{ 23 int __noderef o; 24 int *p = &o; /* check-should-fail */ 25} 26 27static void test_bitwise(void) 28{ 29 int __bitwise o; 30 int *p = &o; /* check-should-fail */ 31} 32 33static void test_user(void) 34{ 35 int __user o; 36 int *p = &o; /* check-should-fail */ 37} 38 39static void test_nocast(void) 40{ 41 int __nocast o; 42 int __nocast *p = &o; /* check-should-pass */ 43} 44 45/* Should be ignored? */ 46static void test_static(void) 47{ 48 /* storage is not inherited */ 49 static int o; 50 int *p = &o; /* check-should-pass */ 51} 52 53static void test_tls(void) 54{ 55 /* storage is not inherited */ 56 static __thread int o; 57 int *p = &o; /* check-should-pass */ 58} 59 60/* 61 * check-name: ptr-inherit.c 62 * 63 * check-error-start 64ptr-inherit.c:12:19: warning: incorrect type in initializer (different modifiers) 65ptr-inherit.c:12:19: expected int *p 66ptr-inherit.c:12:19: got int const * 67ptr-inherit.c:18:19: warning: incorrect type in initializer (different modifiers) 68ptr-inherit.c:18:19: expected int *p 69ptr-inherit.c:18:19: got int volatile * 70ptr-inherit.c:24:19: warning: incorrect type in initializer (different modifiers) 71ptr-inherit.c:24:19: expected int *p 72ptr-inherit.c:24:19: got int [noderef] * 73ptr-inherit.c:30:19: warning: incorrect type in initializer (different base types) 74ptr-inherit.c:30:19: expected int *p 75ptr-inherit.c:30:19: got restricted int * 76ptr-inherit.c:36:19: warning: incorrect type in initializer (different address spaces) 77ptr-inherit.c:36:19: expected int *p 78ptr-inherit.c:36:19: got int <asn:1> * 79 * check-error-end 80 */ 81