modernc.org/cc@v1.0.1/testdata/gcc-6.3.0/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c (about)

     1  extern int inside_main;
     2  extern void abort (void);
     3  #ifdef __OPTIMIZE__
     4  #define ABORT_INSIDE_MAIN do { if (inside_main) abort (); } while (0)
     5  #else
     6  #define ABORT_INSIDE_MAIN do { } while (0)
     7  #endif
     8  
     9  typedef __INTMAX_TYPE__ intmax_t;
    10  
    11  __attribute__ ((__noinline__))
    12  int
    13  abs (int x)
    14  {
    15    ABORT_INSIDE_MAIN;
    16    return x < 0 ? -x : x;
    17  }
    18  
    19  __attribute__ ((__noinline__))
    20  long
    21  labs (long x)
    22  {
    23    ABORT_INSIDE_MAIN;
    24    return x < 0 ? -x : x;
    25  }
    26  
    27  __attribute__ ((__noinline__))
    28  long long
    29  llabs (long long x)
    30  {
    31    ABORT_INSIDE_MAIN;
    32    return x < 0 ? -x : x;
    33  }
    34  
    35  __attribute__ ((__noinline__))
    36  intmax_t
    37  imaxabs (intmax_t x)
    38  {
    39    ABORT_INSIDE_MAIN;
    40    return x < 0 ? -x : x;
    41  }