X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0f5e8daaa6e9f74521068aa75837200bcd182ea6..cc01c6a871dbbfd0cc84e26eb9f94aeb539e613e:/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c diff --git a/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c b/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c index 059941d8e3..865eeafc8c 100644 --- a/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c +++ b/buildtools/Cmake/test_prog/prog_GRAS_CHECK_STRUCT_COMPACTION.c @@ -5,62 +5,68 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include -#include /* offsetof() */ +#include /* offsetof() */ #include -int main (void) +int main(void) { -struct s0 {char c0; double d0;}; -struct s1 {double d1; int i1; char c1;}; -struct s2 {double d2; int i2; char c2[6];}; -struct s3 {double d3; int a3; int b3;}; + struct s0 { + char c0; + double d0; + }; + struct s1 { + double d1; + int i1; + char c1; + }; + struct s2 { + double d2; + int i2; + char c2[6]; + }; + struct s3 { + double d3; + int a3; + int b3; + }; -int gras_struct_packed; -int gras_struct_compact; -int gras_array_straddle_struct; -int gras_compact_struct; + int gras_struct_packed; + int gras_struct_compact; + int gras_array_straddle_struct; + int gras_compact_struct; - if (sizeof(struct s0) == sizeof(double)+sizeof(char)) - { - gras_struct_packed=1; - } - else - { - gras_struct_packed=0; - } - if (offsetof(struct s1,c1) == sizeof(double)+sizeof(int)) - { - gras_struct_compact=1; - } - else - { - gras_struct_compact=0; - } - if (offsetof(struct s2,c2) == sizeof(double)+sizeof(int)) - { - gras_array_straddle_struct=1; - } - else - { - gras_array_straddle_struct=0; - } - if (offsetof(struct s3,b3) == sizeof(double)+sizeof(int)) - { - gras_compact_struct=1; - } - else - { - gras_compact_struct=0; - } + if (sizeof(struct s0) == sizeof(double) + sizeof(char)) { + gras_struct_packed = 1; + } else { + gras_struct_packed = 0; + } + if (offsetof(struct s1, c1) == sizeof(double) + sizeof(int)) { + gras_struct_compact = 1; + } else { + gras_struct_compact = 0; + } + if (offsetof(struct s2, c2) == sizeof(double) + sizeof(int)) { + gras_array_straddle_struct = 1; + } else { + gras_array_straddle_struct = 0; + } + if (offsetof(struct s3, b3) == sizeof(double) + sizeof(int)) { + gras_compact_struct = 1; + } else { + gras_compact_struct = 0; + } - if(gras_struct_packed == 0 && gras_struct_compact == 1) printf("GRAS_STRUCT_COMPACT "); + if (gras_struct_packed == 0 && gras_struct_compact == 1) + printf("GRAS_STRUCT_COMPACT "); - if(gras_array_straddle_struct == 1) printf("GRAS_ARRAY_STRADDLE_STRUCT "); + if (gras_array_straddle_struct == 1) + printf("GRAS_ARRAY_STRADDLE_STRUCT "); - if(gras_compact_struct == 1) printf("GRAS_COMPACT_STRUCT "); + if (gras_compact_struct == 1) + printf("GRAS_COMPACT_STRUCT "); -return 1; + return 1; }