OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [compat/] [struct-layout-1_x1.h] - Diff between revs 298 and 384

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 384
#include "struct-layout-1.h"
#include "struct-layout-1.h"
 
 
struct Info info;
struct Info info;
int fails;
int fails;
int intarray[256];
int intarray[256];
int fn0 (void) { return 0; }
int fn0 (void) { return 0; }
int fn1 (void) { return 1; }
int fn1 (void) { return 1; }
int fn2 (void) { return 2; }
int fn2 (void) { return 2; }
int fn3 (void) { return 3; }
int fn3 (void) { return 3; }
int fn4 (void) { return 4; }
int fn4 (void) { return 4; }
int fn5 (void) { return 5; }
int fn5 (void) { return 5; }
int fn6 (void) { return 6; }
int fn6 (void) { return 6; }
int fn7 (void) { return 7; }
int fn7 (void) { return 7; }
int fn8 (void) { return 8; }
int fn8 (void) { return 8; }
int fn9 (void) { return 9; }
int fn9 (void) { return 9; }
 
 
/* This macro is intended for fields where their
/* This macro is intended for fields where their
   addresses/sizes/alignments and value passing should be checked.  */
   addresses/sizes/alignments and value passing should be checked.  */
#define F(n, x, v, w)                                           \
#define F(n, x, v, w)                                           \
  info.flds[i] = &s##n.x;                                       \
  info.flds[i] = &s##n.x;                                       \
  info.sizes[i] = sizeof (s##n.x);                              \
  info.sizes[i] = sizeof (s##n.x);                              \
  info.aligns[i] = __alignof__ (s##n.x);                        \
  info.aligns[i] = __alignof__ (s##n.x);                        \
  s##n.x = v;                                                   \
  s##n.x = v;                                                   \
  a##n[2].x = w;                                                \
  a##n[2].x = w;                                                \
  ++i;
  ++i;
/* This macro is for fields where just their addresses/sizes/alignments
/* This macro is for fields where just their addresses/sizes/alignments
   should be checked.  */
   should be checked.  */
#define N(n, x)                                                 \
#define N(n, x)                                                 \
  info.flds[i] = &s##n.x;                                       \
  info.flds[i] = &s##n.x;                                       \
  info.sizes[i] = sizeof (s##n.x);                              \
  info.sizes[i] = sizeof (s##n.x);                              \
  info.aligns[i] = __alignof__ (s##n.x);                        \
  info.aligns[i] = __alignof__ (s##n.x);                        \
  ++i;
  ++i;
/* This macro is for fields where just value passing should be checked.  */
/* This macro is for fields where just value passing should be checked.  */
#define B(n, x, v, w)                                           \
#define B(n, x, v, w)                                           \
  s##n.x = v;                                                   \
  s##n.x = v;                                                   \
  a##n[2].x = w;                                                \
  a##n[2].x = w;                                                \
  ++j;
  ++j;
#define TX(n, type, attrs, fields, ops)                         \
#define TX(n, type, attrs, fields, ops)                         \
type S##n { fields } attrs;                                     \
type S##n { fields } attrs;                                     \
type S##n s##n;                                                 \
type S##n s##n;                                                 \
extern type S##n a##n[5];                                       \
extern type S##n a##n[5];                                       \
extern type S##n check##n (type S##n, type S##n *,              \
extern type S##n check##n (type S##n, type S##n *,              \
                             type S##n);                        \
                             type S##n);                        \
extern void check##n##va (int i, ...);                          \
extern void check##n##va (int i, ...);                          \
extern void checkx##n (type S##n);                              \
extern void checkx##n (type S##n);                              \
void test##n (void)                                             \
void test##n (void)                                             \
{                                                               \
{                                                               \
  int i, j;                                                     \
  int i, j;                                                     \
  memset (&s##n, '\0', sizeof (s##n));                          \
  memset (&s##n, '\0', sizeof (s##n));                          \
  memset (a##n, '\0', sizeof (a##n));                           \
  memset (a##n, '\0', sizeof (a##n));                           \
  memset (&info, '\0', sizeof (info));                          \
  memset (&info, '\0', sizeof (info));                          \
  info.sp = &s##n;                                              \
  info.sp = &s##n;                                              \
  info.a0p = &a##n[0];                                          \
  info.a0p = &a##n[0];                                          \
  info.a3p = &a##n[3];                                          \
  info.a3p = &a##n[3];                                          \
  info.sz = sizeof (s##n);                                      \
  info.sz = sizeof (s##n);                                      \
  info.als = __alignof__ (s##n);                                \
  info.als = __alignof__ (s##n);                                \
  info.ala0 = __alignof__ (a##n[0]);                            \
  info.ala0 = __alignof__ (a##n[0]);                            \
  info.ala3 = __alignof__ (a##n[3]);                            \
  info.ala3 = __alignof__ (a##n[3]);                            \
  if (((long) &a##n[3]) & (info.als - 1))                       \
  if (((long) &a##n[3]) & (info.als - 1))                       \
    FAIL (n, 1);                                                \
    FAIL (n, 1);                                                \
  i = 0; j = 0;                                                   \
  i = 0; j = 0;                                                   \
  ops                                                           \
  ops                                                           \
  info.nfields = i;                                             \
  info.nfields = i;                                             \
  info.nbitfields = j;                                          \
  info.nbitfields = j;                                          \
  checkx##n (check##n (s##n, &a##n[1], a##n[2]));               \
  checkx##n (check##n (s##n, &a##n[1], a##n[2]));               \
  check##n##va (1, 1.0, s##n, 2LL, a##n[2], a##n[2]);           \
  check##n##va (1, 1.0, s##n, 2LL, a##n[2], a##n[2]);           \
  check##n##va (2, s##n, s##n, 2.0L, a##n[2], s##n);            \
  check##n##va (2, s##n, s##n, 2.0L, a##n[2], s##n);            \
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.