1 /* Functional tests for the function hotpatching feature. */ 2 3 /* { dg-do run } */ 4 /* { dg-options "-O3 -mzarch -mno-hotpatch" } */ 5 6 #include <stdio.h> 7 8 __attribute__ ((hotpatch)) hp1(void)9void hp1(void) 10 { 11 printf("hello, world!\n"); 12 } 13 14 __attribute__ ((hotpatch)) hp2(void)15inline void hp2(void) 16 { 17 printf("hello, world!\n"); 18 } 19 20 __attribute__ ((hotpatch)) 21 __attribute__ ((always_inline)) hp3(void)22void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ 23 { 24 printf("hello, world!\n"); 25 } /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ 26 27 __attribute__ ((hotpatch(0))) hp4(void)28void hp4(void) 29 { 30 printf("hello, world!\n"); 31 } 32 33 __attribute__ ((hotpatch(0))) hp5(void)34inline void hp5(void) 35 { 36 printf("hello, world!\n"); 37 } 38 39 __attribute__ ((hotpatch(0))) 40 __attribute__ ((always_inline)) hp6(void)41void hp6(void) /* { dg-warning "always_inline function might not be inlinable" } */ 42 { 43 printf("hello, world!\n"); 44 } /* { dg-warning "function 'hp6' with the 'always_inline' attribute is not hotpatchable" } */ 45 46 __attribute__ ((hotpatch(1))) hp7(void)47void hp7(void) 48 { 49 printf("hello, world!\n"); 50 } 51 52 __attribute__ ((hotpatch(1))) hp8(void)53inline void hp8(void) 54 { 55 printf("hello, world!\n"); 56 } 57 58 __attribute__ ((hotpatch(1))) 59 __attribute__ ((always_inline)) hp9(void)60void hp9(void) /* { dg-warning "always_inline function might not be inlinable" } */ 61 { 62 printf("hello, world!\n"); 63 } /* { dg-warning "function 'hp9' with the 'always_inline' attribute is not hotpatchable" } */ 64 main(void)65int main (void) 66 { 67 return 0; 68 } 69