nested-fn-1.c

来自「用于进行gcc测试」· C语言 代码 · 共 74 行

C
74
字号
/* PR middle-end/15345, c/16450 *//* Test whether unused nested functions aren't emitted into the assembly.  *//* { dg-do compile } *//* { dg-options "-g0" } */intfn1 (int x){  int i = x;  inline __attribute__((always_inline)) int  should_not_appear1 (void)  {    return i;  }  return should_not_appear1 ();}intfn2 (int x){  int i = x;  inline __attribute__((always_inline)) int  should_not_appear2 (void)  {    return i;  }  return x;}extern void check (void *p);intfn3 (int x){  int i = x;  inline int  should_appear1 (void)  {    char *p = __builtin_alloca (i);    check (p);    return i;  }  return should_appear1 ();}intfn4 (int x){  int i = x;  inline int  should_not_appear3 (void)  {    char *p = __builtin_alloca (i);    check (p);    return i;  }  return 0 ? should_not_appear3 () : 1;}intfn5 (int x){  int i = x;  inline int  should_appear2 (void)  {    return i;  }  check (should_appear2);  return i;}/* { dg-final { scan-assembler-not "should_not_appear" } } */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?