diff options
author | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-22 18:51:16 +0000 |
---|---|---|
committer | (no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-22 18:51:16 +0000 |
commit | 3620a217adfbde3c2249b18205d19c13b317f3b0 (patch) | |
tree | 8c306f5f27b8edf1ef6e9ea83e476b9872e5642a /gcc/testsuite/gcc.apple/align-test-5b.c | |
parent | 86248a4b2696dd0f45ceabfd239e870ba0d36c89 (diff) |
This commit was manufactured by cvs2svn to create tagapple/gcc-1742
'apple-gcc-1742'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/apple-gcc-1742@81049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.apple/align-test-5b.c')
-rw-r--r-- | gcc/testsuite/gcc.apple/align-test-5b.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.apple/align-test-5b.c b/gcc/testsuite/gcc.apple/align-test-5b.c new file mode 100644 index 00000000000..6845bd34766 --- /dev/null +++ b/gcc/testsuite/gcc.apple/align-test-5b.c @@ -0,0 +1,87 @@ +/* APPLE LOCAL file Macintosh alignment */ +/* align-test-5*.c are all the same code but with different options. */ + +/* { dg-do run } */ +/* { dg-options "-malign-power -DSIZE=12" } */ + +/* + * GCC alignment test for command line options for setting alignment modes. + * Fred Forsman + * Apple Computer, Inc. + * (C) 2000-2002. + * Last modified 2002-2-18. + * + */ + + /* Check whether we are testing GCC 3 or later. */ +#ifdef __GNUC__ +#if __GNUC__ >= 3 +#define GCC3 1 +#else +#define GCC3 0 +#endif +#endif + +#include <stdio.h> +#include <stddef.h> +#include <string.h> + +#define Q(x) #x, x + +typedef unsigned char UINT8; +typedef unsigned long UINT32; + +static int bad_option = 0; +static int flag_verbose = 0; +static int nbr_failures = 0; + +typedef struct S0 { + UINT8 f1; + double f2; +} S0; + +static void check(char * rec_name, int actual, int expected, char * comment) +{ + if (flag_verbose || (actual != expected)) { + printf("%-20s = %2d (%2d) ", rec_name, actual, expected); + if (actual != expected) { + printf("*** FAIL"); + nbr_failures++; + } else + printf(" PASS"); + printf(": %s\n", comment); + } +} + +static void check_option(char *option) +{ + if (*option == '-') { + if (strcmp(option, "-v") == 0) + flag_verbose = 1; + else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } + } else { + fprintf(stderr, "*** unrecognized option '%s'.\n", option); + bad_option = 1; + } +} + +int main(int argc, char *argv[]) +{ + int i; + + for (i = 1; i < argc; i++) + check_option(argv[i]); + + if (bad_option) + return 1; + + check(Q(sizeof(S0)), SIZE, "struct with 1 char, 1 double"); + + if (nbr_failures > 0) + return 1; + else + return 0; +} |