1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include <stddef.h> /* offsetof() */
34 int gras_struct_packed;
35 int gras_struct_compact;
36 int gras_array_straddle_struct;
37 int gras_compact_struct;
39 if (sizeof(struct s0) == sizeof(double) + sizeof(char)) {
40 gras_struct_packed = 1;
42 gras_struct_packed = 0;
44 if (offsetof(struct s1, c1) == sizeof(double) + sizeof(int)) {
45 gras_struct_compact = 1;
47 gras_struct_compact = 0;
49 if (offsetof(struct s2, c2) == sizeof(double) + sizeof(int)) {
50 gras_array_straddle_struct = 1;
52 gras_array_straddle_struct = 0;
54 if (offsetof(struct s3, b3) == sizeof(double) + sizeof(int)) {
55 gras_compact_struct = 1;
57 gras_compact_struct = 0;
61 if (gras_struct_packed == 0 && gras_struct_compact == 1)
62 printf("GRAS_STRUCT_COMPACT ");
64 if (gras_array_straddle_struct == 1)
65 printf("GRAS_ARRAY_STRADDLE_STRUCT ");
67 if (gras_compact_struct == 1)
68 printf("GRAS_COMPACT_STRUCT ");