github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/tests/code_quality/unsafe.c (about)

     1  #define unsafetype(type, name) \
     2      void name()                \
     3      {                          \
     4          type t;                \
     5          type* pt = &t;         \
     6          (void)(t);             \
     7          (void)(pt);            \
     8      }
     9  
    10  struct str {
    11      int i;
    12  };
    13  
    14  union un {
    15      int i;
    16      double d;
    17  };
    18  
    19  typedef double db;
    20  
    21  // integers
    22  unsafetype(char, test_char);
    23  unsafetype(short, test_short);
    24  unsafetype(int, test_int);
    25  unsafetype(long, test_long);
    26  unsafetype(long int, test_li);
    27  unsafetype(long long, test_ll);
    28  unsafetype(long long int, test_lli);
    29  
    30  // floats
    31  unsafetype(float, test_f);
    32  unsafetype(double, test_d);
    33  unsafetype(long double, test_ld);
    34  
    35  // struct
    36  unsafetype(struct str, test_struct);
    37  
    38  // union
    39  unsafetype(union un, test_un);
    40  
    41  // typedef
    42  unsafetype(db, test_typedef);