New module attribute 'Applicability'.
[gnulib.git] / tests / test-alignof.c
index 851cbf0..d42bdf5 100644 (file)
 #include <alignof.h>
 
 #include <stddef.h>
+#include <stdint.h>
 
 #include "verify.h"
 
+typedef long double longdouble;
 typedef struct { char a[1]; } struct1;
 typedef struct { char a[2]; } struct2;
 typedef struct { char a[3]; } struct3;
@@ -31,7 +33,9 @@ typedef struct { char a[4]; } struct4;
 
 #define CHECK(type) \
   typedef struct { char slot1; type slot2; } type##_helper; \
-  verify (alignof (type) == offsetof (type##_helper, slot2));
+  verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \
+  const int type##_slot_alignment = alignof_slot (type); \
+  const int type##_type_alignment = alignof_type (type);
 
 CHECK (char)
 CHECK (short)
@@ -39,6 +43,10 @@ CHECK (int)
 CHECK (long)
 CHECK (float)
 CHECK (double)
+CHECK (longdouble)
+#ifdef INT64_MAX
+CHECK (int64_t)
+#endif
 CHECK (struct1)
 CHECK (struct2)
 CHECK (struct3)