summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c
blob: 2727015a0b8bd3c20d367e36d07f1e23cc12cce2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */

/* Disable this test for 16-bit targets.  */

#include <limits.h>

#if !(defined __GNUC__) || (INT_MAX > 32767)

#include "compat-common.h"
#include "struct-align-2.h"

#define TEST(NAME)						\
struct outer_##NAME {						\
  int i;							\
  struct epoll_event_##NAME ee;					\
};								\
								\
extern unsigned int v1_##NAME;					\
extern unsigned int v2_##NAME;					\
extern unsigned long long v3_##NAME;				\
								\
extern struct outer_##NAME s_##NAME[2];				\
								\
extern void pass_##NAME (struct outer_##NAME);			\
extern struct outer_##NAME return_##NAME (void);		\
								\
void								\
checkp_##NAME (struct outer_##NAME *p)				\
{								\
  if (p->i != v1_##NAME)					\
    DEBUG_CHECK;						\
  if (p->ee.events != v2_##NAME)				\
    DEBUG_CHECK;						\
  if (p->ee.data != v3_##NAME)					\
    DEBUG_CHECK;						\
}								\
								\
void								\
test_##NAME (void)						\
{								\
  struct outer_##NAME s;					\
  DEBUG_FPUTS (DESC_##NAME);					\
  DEBUG_NL;							\
  DEBUG_FPUTS ("  global array");				\
  checkp_##NAME (&s_##NAME[0]);					\
  checkp_##NAME (&s_##NAME[1]);					\
  DEBUG_NL;							\
  DEBUG_FPUTS ("  argument");					\
  pass_##NAME (s_##NAME[0]);					\
  DEBUG_NL;							\
  DEBUG_FPUTS ("  function result");				\
  s = return_##NAME ();						\
  checkp_##NAME (&s);						\
  DEBUG_NL;							\
}

TEST (orig)
#ifndef SKIP_ATTRIBUTE
TEST (structmax)
TEST (struct4)
TEST (struct8)
TEST (data4)
TEST (data8)
TEST (p)
TEST (pstruct4)
TEST (pstruct8)
TEST (pdata4)
TEST (pdata8)
#endif

#else

int i;  /* prevent compiling an empty file */

#endif  /* INT_MAX */