11f5207b7SJohn Levon #define __user __attribute__((address_space(1))) 21f5207b7SJohn Levon #define __noderef __attribute__((noderef)) 31f5207b7SJohn Levon #define __bitwise __attribute__((bitwise)) 41f5207b7SJohn Levon #define __nocast __attribute__((nocast)) 51f5207b7SJohn Levon #define __safe __attribute__((safe)) 61f5207b7SJohn Levon 71f5207b7SJohn Levon 81f5207b7SJohn Levon /* Should be inherited? */ test_const(void)91f5207b7SJohn Levonstatic void test_const(void) 101f5207b7SJohn Levon { 111f5207b7SJohn Levon const int o; 121f5207b7SJohn Levon int *p = &o; /* check-should-fail */ 131f5207b7SJohn Levon } 141f5207b7SJohn Levon test_volatile(void)151f5207b7SJohn Levonstatic void test_volatile(void) 161f5207b7SJohn Levon { 171f5207b7SJohn Levon volatile int o; 181f5207b7SJohn Levon int *p = &o; /* check-should-fail */ 191f5207b7SJohn Levon } 201f5207b7SJohn Levon test_noderef(void)211f5207b7SJohn Levonstatic void test_noderef(void) 221f5207b7SJohn Levon { 231f5207b7SJohn Levon int __noderef o; 241f5207b7SJohn Levon int *p = &o; /* check-should-fail */ 251f5207b7SJohn Levon } 261f5207b7SJohn Levon test_bitwise(void)271f5207b7SJohn Levonstatic void test_bitwise(void) 281f5207b7SJohn Levon { 291f5207b7SJohn Levon int __bitwise o; 301f5207b7SJohn Levon int *p = &o; /* check-should-fail */ 311f5207b7SJohn Levon } 321f5207b7SJohn Levon test_user(void)331f5207b7SJohn Levonstatic void test_user(void) 341f5207b7SJohn Levon { 351f5207b7SJohn Levon int __user o; 361f5207b7SJohn Levon int *p = &o; /* check-should-fail */ 371f5207b7SJohn Levon } 381f5207b7SJohn Levon test_nocast(void)391f5207b7SJohn Levonstatic void test_nocast(void) 401f5207b7SJohn Levon { 411f5207b7SJohn Levon int __nocast o; 421f5207b7SJohn Levon int __nocast *p = &o; /* check-should-pass */ 431f5207b7SJohn Levon } 441f5207b7SJohn Levon 451f5207b7SJohn Levon /* Should be ignored? */ test_static(void)461f5207b7SJohn Levonstatic void test_static(void) 471f5207b7SJohn Levon { 481f5207b7SJohn Levon /* storage is not inherited */ 491f5207b7SJohn Levon static int o; 501f5207b7SJohn Levon int *p = &o; /* check-should-pass */ 511f5207b7SJohn Levon } 521f5207b7SJohn Levon test_tls(void)531f5207b7SJohn Levonstatic void test_tls(void) 541f5207b7SJohn Levon { 551f5207b7SJohn Levon /* storage is not inherited */ 561f5207b7SJohn Levon static __thread int o; 571f5207b7SJohn Levon int *p = &o; /* check-should-pass */ 581f5207b7SJohn Levon } 591f5207b7SJohn Levon 601f5207b7SJohn Levon /* 611f5207b7SJohn Levon * check-name: ptr-inherit.c 621f5207b7SJohn Levon * 631f5207b7SJohn Levon * check-error-start 641f5207b7SJohn Levon ptr-inherit.c:12:19: warning: incorrect type in initializer (different modifiers) 651f5207b7SJohn Levon ptr-inherit.c:12:19: expected int *p 66*c85f09ccSJohn Levon ptr-inherit.c:12:19: got int const * 671f5207b7SJohn Levon ptr-inherit.c:18:19: warning: incorrect type in initializer (different modifiers) 681f5207b7SJohn Levon ptr-inherit.c:18:19: expected int *p 69*c85f09ccSJohn Levon ptr-inherit.c:18:19: got int volatile * 701f5207b7SJohn Levon ptr-inherit.c:24:19: warning: incorrect type in initializer (different modifiers) 711f5207b7SJohn Levon ptr-inherit.c:24:19: expected int *p 72*c85f09ccSJohn Levon ptr-inherit.c:24:19: got int [noderef] * 731f5207b7SJohn Levon ptr-inherit.c:30:19: warning: incorrect type in initializer (different base types) 741f5207b7SJohn Levon ptr-inherit.c:30:19: expected int *p 75*c85f09ccSJohn Levon ptr-inherit.c:30:19: got restricted int * 761f5207b7SJohn Levon ptr-inherit.c:36:19: warning: incorrect type in initializer (different address spaces) 771f5207b7SJohn Levon ptr-inherit.c:36:19: expected int *p 78*c85f09ccSJohn Levon ptr-inherit.c:36:19: got int <asn:1> * 791f5207b7SJohn Levon * check-error-end 801f5207b7SJohn Levon */ 81