shebs       02/09/01 20:34:34

  Added:       gcc/testsuite/gcc.apple Wextra-tokens.c
                        Wfour-char-constants-1.c Wfour-char-constants-2.c
                        Wlong-double.c Wmost.c altivec-1.c altivec-2.c
                        const-cfstring-1.c const-cfstring-2.c dg.exp
                        import.c importee.h no-warning.c pascal-strings-1.c
                        pascal-strings-2.c preprocess.s
               gcc/testsuite/gcc.apple/special apple.exp zerofill.c
  Log:
  Beginning of Apple-feature-specific testsuite.
  
  Revision  Changes    Path
  1.1                  gcc3/gcc/testsuite/gcc.apple/Wextra-tokens.c
  
  Index: Wextra-tokens.c
  ===================================================================
  /* APPLE LOCAL file -Wextra-tokens */
  /* Lifted from gcc.dg/cpp/extratokens2.c. */
  /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-fno-show-column -Wextra-tokens" } */
  
  /* Tests that -Wextra-tokens correctly enables the checks
     that are disabled by default.  */
  
  #if 1 
  #if 0
  #else foo     /* { dg-bogus "extra tokens" "bad warning" } */
  #endif /      /* { dg-bogus "extra tokens" "bad warning" } */
  #endif
  
  # 36 "file.c" 3
  
  /* ... but in a system header, it's acceptable.  */
  #ifdef KERNEL
  #endif KERNEL  /* { dg-bogus "extra tokens" "bad warning" } */
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/Wfour-char-constants-1.c
  
  Index: Wfour-char-constants-1.c
  ===================================================================
  /* APPLE LOCAL file -Wfour-char-constants */
  /* We warn by default on Darwin, so no specific option needed.  */
  
  /* { dg-do compile { target "*-*-darwin*" } } */
  /* { dg-options "" } */
  
  int glob1 = 'a';
  int glob2 = 'ab';     /* { dg-warning "multi-character character constant" } */
  int glob3 = 'abc';    /* { dg-warning "multi-character character constant" } */
  int glob4 = 'abcd';     /* say nothing */
  int glob5 = 'abcde';  /* { dg-warning "character constant too long" } */
  
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/Wfour-char-constants-2.c
  
  Index: Wfour-char-constants-2.c
  ===================================================================
  /* APPLE LOCAL file -Wfour-char-constants */
  /* Explicitly enable the warning.  */
  
  /* { dg-do compile } */
  /* { dg-options "-Wfour-char-constants" } */
  
  int glob1 = 'a';
  int glob2 = 'ab';     /* { dg-warning "multi-character character constant" } */
  int glob3 = 'abc';    /* { dg-warning "multi-character character constant" } */
  int glob4 = 'abcd';     /* { dg-warning "multi-character character constant" } */
  int glob5 = 'abcde';  /* { dg-warning "character constant too long" } */
  
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/Wlong-double.c
  
  Index: Wlong-double.c
  ===================================================================
  /* APPLE LOCAL file -Wlong-double */
  
  /* We warn by default, so no specific option needed.  */
  
  /* { dg-do compile { target "*-*-darwin*" } } */
  /* { dg-options "" } */
  
  long double ld;  /* { dg-warning "use of `long double' type" } */
  /* { dg-warning "is reported only once" "" { target *-*-* } 8 } */
  /* { dg-warning "disable this warning" "" { target *-*-* } 8 } */
  
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/Wmost.c
  
  Index: Wmost.c
  ===================================================================
  /* APPLE LOCAL file -Wmost */
  
  /* { dg-do compile } */
  /* { dg-options "-Wmost" } */
  
  int baz (void);
  
  int
  foo ()
  {
    int loc;
  
    bar ();  /* { dg-warning "implicit declaration" } */
  
    if (loc = baz ())  /* be quiet about this */
      return 1;
    return 0;
  }
  
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/altivec-1.c
  
  Index: altivec-1.c
  ===================================================================
  /* APPLE LOCAL file AltiVec */
  /* { dg-do run { target powerpc-apple-darwin* } } */
  /* { dg-options "-faltivec -Wno-long-double" } */
  
  /* Test for correct handling of AltiVec constants passed
     through '...' (va_arg).  */
  
  #include <stdarg.h>
  #include <stdio.h>
  #include <stdlib.h>
  
  #define CHECK_INVARIANT(expr) \
    if (!(expr)) { \
      printf ("ASSERT FAILED: %d: %s\n", __LINE__, #expr); \
      abort (); \
    }
  
  struct foo { int x; int y; };
  struct vfoo { int x; __vector signed int v; int y; };
  union u { __vector signed int v; signed int i[4]; };
  
  struct foo x_g = { 3, 4};
  struct vfoo vx_g = { 10, (vector signed int)(11, 12, 13, 14), 15 };
  __vector signed int v_g = (vector signed int) (22, 23, 24, 25);
  struct vfoo vx2_g = { 30, (vector signed int)(31, 32, 33, 34), 35 };
  __vector signed int v2_g = (vector signed int)(40, 41, 42, 43);
  int i_1 = 99, i_2 = 33;
  double d_2 = 1.5, d_3 = 1.75;
  long double ld_1 = 1.25;
  
  void bar (int i, ... )
  {
      struct foo xi;
      double d;
      long double ld;
      float f;
      char c;
      short s;
      va_list ap;
      va_start(ap, i);
      xi = va_arg(ap, struct foo);
      s = (short)va_arg(ap, int);
      f = (float)va_arg(ap, double);
      ld = va_arg(ap, long double);
      c = (char)va_arg(ap, int);
      d = va_arg(ap, double);
      va_end(ap);
      
      CHECK_INVARIANT (xi.x == x_g.x && xi.y == x_g.y);
      CHECK_INVARIANT (s == (short)i_2);
      CHECK_INVARIANT (f == (float)d_2);
      CHECK_INVARIANT (ld == ld_1);
      CHECK_INVARIANT (c == (char)i_1);
      CHECK_INVARIANT (d == d_3);
  }
  
  void baz (int i, ... )
  {
      struct vfoo vx, vx2;
      __vector signed int v_i, v2_i;
      int j, k, l;
      va_list ap;
      va_start(ap, i);
      v_i = va_arg(ap, __vector signed int);
      j = va_arg(ap, int);
      vx = va_arg(ap, struct vfoo);
      k = va_arg(ap, int);
      v2_i = va_arg(ap, __vector signed int);
      l = va_arg(ap, int);
      vx2 = va_arg(ap, struct vfoo);
      va_end(ap);
        
      CHECK_INVARIANT (vec_all_eq (v_i, v_g));
      CHECK_INVARIANT (j == i_1);
      CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
      CHECK_INVARIANT (k == i_1);
      CHECK_INVARIANT (vec_all_eq (v2_i, v2_g));
      CHECK_INVARIANT (l == i_1);
      CHECK_INVARIANT (vx2.x == vx2_g.x && vec_all_eq(vx2.v, vx2_g.v) && vx2.y == 
vx2_g.y);
  }
  
  void quux (int i, ... )
  {
      __vector signed int v_i, v2_i;
      union u vi, v2i;
      va_list ap;
      va_start(ap, i);
      v_i = va_arg(ap, __vector signed int);
      v2_i = va_arg(ap, __vector signed int);
      va_end(ap);
      vi.v = v_i;
      v2i.v = v2_i;
  
      CHECK_INVARIANT (vec_all_eq (v_i, v_g));
      CHECK_INVARIANT (vec_all_eq (v2_i, v_g));
      CHECK_INVARIANT (vec_all_eq (vi.v, v_g));
      CHECK_INVARIANT (vec_all_eq (v2i.v, v_g));
  }
  
  void baz2 (int i, ... )
  {
      struct vfoo vx;
      union u vxi;
      va_list ap;
      va_start(ap, i);
      vx = va_arg(ap, struct vfoo);
      va_end(ap);
      vxi.v = vx.v;
  
      CHECK_INVARIANT (vx.x == vx_g.x && vec_all_eq(vx.v, vx_g.v) && vx.y == vx_g.y);
      CHECK_INVARIANT (vec_all_eq (vxi.v, vx_g.v));
  }
  
  int main(void)
  {
      CHECK_INVARIANT (sizeof(struct foo) == 8 && sizeof(struct vfoo) == 48);
  
      bar(i_1, x_g, (short)i_2, (float)d_2, ld_1, (char)i_1, d_3);
      baz(i_1, v_g, i_1, vx_g, i_1, v2_g, i_1, vx2_g);
      quux(i_1, v_g, v_g);
      baz2(i_1, vx_g);
  
      return 0;
  }
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/altivec-2.c
  
  Index: altivec-2.c
  ===================================================================
  /* APPLE LOCAL file AltiVec */
  /* { dg-do compile { target powerpc-apple-darwin* } } */
  /* { dg-options "-faltivec" } */
  
  void foo() {
    vector bool int boolVector = (vector bool int) vec_splat_u32(3);
    boolVector = vec_sld( boolVector, boolVector, 
      1 );  /* { dg-bogus "no instance of overloaded" } */
  }
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/const-cfstring-1.c
  
  Index: const-cfstring-1.c
  ===================================================================
  /* APPLE LOCAL file constant cfstrings */
  /* Test whether the __builtin__CFStringMakeConstantString 
     "function" fails gracefully when handed a non-constant
     argument.  This will only work on MacOS X 10.1.2 and later.  */
  /* Developed by Ziemowit Laski <[EMAIL PROTECTED]>.  */
  
  /* { dg-do compile { target powerpc-apple-darwin* } } */
  /* { dg-options "-fconstant-cfstrings" } */
  
  #import <CoreFoundation/CFString.h>
  
  #ifdef __CONSTANT_CFSTRINGS__
  #undef CFSTR
  #define CFSTR(STR)  ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
  #endif
  
  extern int cond;
  extern const char *func(void);
  
  int main(void) {
    CFStringRef s1 = CFSTR("Str1");
    CFStringRef s2 = CFSTR(cond? "Str2": "Str3"); /* { dg-error "CFString literal 
expression not constant" } */
    CFStringRef s3 = CFSTR(func());  /* { dg-error "CFString literal expression not 
constant" } */
  
    return 0;
  }
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/const-cfstring-2.c
  
  Index: const-cfstring-2.c
  ===================================================================
  /* APPLE LOCAL file constant cfstrings */
  /* Test whether the __builtin__CFStringMakeConstantString 
     "function" fails gracefully when used without the
     -fconstant-cfstrings flag.  */
  /* Developed by Ziemowit Laski <[EMAIL PROTECTED]>.  */
  
  /* { dg-options "-fno-constant-cfstrings" } */
  /* { dg-do compile { target *-*-darwin* } } */
  
  #include <CoreFoundation/CFBase.h>
  
  const CFStringRef S = 
((CFStringRef)__builtin___CFStringMakeConstantString("Testing"));
  /* { dg-error "built-in" "built-in function .* requires .* flag" { target *-*-* } 12 
} */
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/dg.exp
  
  Index: dg.exp
  ===================================================================
  # APPLE LOCAL file testsuite
  #   Copyright (C) 1997 Free Software Foundation, Inc.
  
  # This program is free software; you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation; either version 2 of the License, or
  # (at your option) any later version.
  # 
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  # 
  # You should have received a copy of the GNU General Public License
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
  
  # Apple-specific GCC testsuite driver.
  # Note that this is basically a clone of gcc.dg/dg.exp, updated
  # whenever the original file changes (which is not very often).
  
  # Load support procs.
  load_lib gcc-dg.exp
  
  # If a testcase doesn't have special options, use these.
  global DEFAULT_CFLAGS
  if ![info exists DEFAULT_CFLAGS] then {
      set DEFAULT_CFLAGS " -ansi -pedantic-errors"
  }
  
  # Initialize `dg'.
  dg-init
  
  # Main loop.
  # APPLE LOCAL preprocess .s files
  dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSs\]]] \
        "" $DEFAULT_CFLAGS
  
  # All done.
  dg-finish
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/import.c
  
  Index: import.c
  ===================================================================
  /* APPLE LOCAL file #import not deprecated */
  /* { dg-do compile } */
  /* { dg-options "" } */
  
  #import "importee.h"
  
  #import "importee.h"
  
  void foo (bar x) {}
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/importee.h
  
  Index: importee.h
  ===================================================================
  /* APPLE LOCAL file #import not deprecated */
  
  typedef int bar;
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/no-warning.c
  
  Index: no-warning.c
  ===================================================================
  /* APPLE LOCAL file -Wno-#warnings */
  
  /* { dg-do compile } */
  /* { dg-options "-Wno-#warnings" } */
  
  #warning "suppress this warning"
  
  int a;
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/pascal-strings-1.c
  
  Index: pascal-strings-1.c
  ===================================================================
  /* APPLE LOCAL file Pascal strings 2001-07-05 zll */
  /* Positive C test cases.  */
  /* Origin: Ziemowit Laski <[EMAIL PROTECTED]> */
  /* { dg-do run } */
  /* { dg-options "-std=iso9899:1999 -fpascal-strings" } */
  
  typedef __WCHAR_TYPE__ wchar_t;
  typedef __SIZE_TYPE__ size_t;
  
  extern void abort (void);
  extern size_t strlen (const char *s);
  
  const unsigned char *pascalStr1 = "\pHello, World!";
  const unsigned char *concat1 = "\pConcatenated" "string" "\pliteral";
  
  const unsigned char msg1[] = "\pHello";   /* ok */
  const unsigned char *msg2 = "\pHello";    /* ok */
  const signed char msg3[] = "\pHello";     /* ok */
  const char msg4[] = "\pHello";            /* ok */
  unsigned char msg5[] = "\pHello";   /* ok */
  signed char msg7[] = "\pHello";     /* ok */
  char msg8[] = "\pHello";            /* ok */
     
  int
  main (void)
  {
    const unsigned char *pascalStr2 = "\pGood-bye!";
  
    if (strlen ((const char *)pascalStr1) != 14)
      abort ();
    if (*pascalStr1 != 13)
      abort ();  /* the length byte does not include trailing null */
  
    if (strlen ((const char *)pascalStr2) != 10)
      abort ();
    if (*pascalStr2 != 9)
      abort ();
  
    if (strlen ((const char *)concat1) != 26)
      abort ();
    if (*concat1 != 25)
      abort ();
  
    return 0;
  }
  
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/pascal-strings-2.c
  
  Index: pascal-strings-2.c
  ===================================================================
  /* APPLE LOCAL file Pascal strings 2001-07-05 zll */
  /* Negative C test cases.  */
  /* Origin: Ziemowit Laski <[EMAIL PROTECTED]> */
  /* { dg-do compile } */
  /* { dg-options "-std=iso9899:1999 -Wwrite-strings -fpascal-strings" } */
  
  typedef __WCHAR_TYPE__ wchar_t;
  
  const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-error "not allowed in wide" } */
  const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-error "not allowed in wide" } */
  
  const wchar_t *initErr0 = "\pHi";   /* { dg-warning "incompatible pointer type" } */
  const wchar_t initErr0a[] = "\pHi";  /* { dg-error "initialized from non-wide 
string" } */
  const wchar_t *initErr1 = "Bye";   /* { dg-warning "incompatible pointer type" } */
  const wchar_t initErr1a[] = "Bye";   /* { dg-error "initialized from non-wide 
string" } */
  
  const char *initErr2 = L"Hi";   /* { dg-warning "incompatible pointer type" } */
  const char initErr2a[] = L"Hi";  /* { dg-error "initialized from wide string" } */
  const signed char *initErr3 = L"Hi";  /* { dg-warning "incompatible pointer type" } 
*/
  const signed char initErr3a[] = L"Hi";  /* { dg-error "initialized from wide string" 
} */
  const unsigned char *initErr4 = L"Hi";  /* { dg-warning "incompatible pointer type" 
} */
  const unsigned char initErr4a[] = L"Hi"; /* { dg-error "initialized from wide 
string" } */
  
  const char *pascalStr3 = "Hello\p, World!"; /* { dg-error "must be at beginning" } */
  
  const char *concat2 = "Hi" "\pthere"; /* { dg-error "not allowed in concatenation" } 
*/
  const char *concat3 = "Hi" "there\p"; /* { dg-error "must be at beginning" } */
  
  const char *s2 = "\pGoodbye!";   /* ok */
  unsigned char *s3 = "\pHi!";     /* { dg-warning "initialization discards 
qualifiers" } */
  char *s4 = "\pHi";               /* { dg-warning "initialization discards 
qualifiers" } */
  signed char *s5 = "\pHi";        /* { dg-warning "initialization discards 
qualifiers" } */
  const signed char *s6 = "\pHi";  /* ok */
  
  /* the maximum length of a Pascal literal is 255. */
  const unsigned char *almostTooLong =
    
"\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      "123456789012345";  /* ok */
  const unsigned char *definitelyTooLong =
    
"\p12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
      "1234567890123456";  /* { dg-error "too long" } */
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/preprocess.s
  
  Index: preprocess.s
  ===================================================================
  /* APPLE LOCAL file preprocess .s files */
  
  /* Regression test - in assembly language, # may have some significance
     other than 'stringize macro argument' and therefore must be preserved
     in the output, and should not be warned about.  */
  
  /* { dg-do preprocess } */
  
  #define foo() mov r0, #5  /* { dg-bogus "not followed" "spurious warning" } */
  
  entry:
        foo()
  
  /* Check we don't EOF on an unknown directive.  */
  #unknown directive
  #error a later diagnostic     /* { dg-error "diagnostic" } */
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/special/apple.exp
  
  Index: apple.exp
  ===================================================================
  # APPLE LOCAL file testsuite
  #   Copyright (C) 2002 Free Software Foundation, Inc.
  
  # This program is free software; you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation; either version 2 of the License, or
  # (at your option) any later version.
  # 
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  # 
  # You should have received a copy of the GNU General Public License
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
  
  
  # Load support procs.
  load_lib gcc-dg.exp
  
  # Initialize `dg'.
  dg-init
  
  # Test the zerofill support by seeing if a file with a large array
  # compiled -fno-common has a small size on disk.
  
  gcc_target_compile "$srcdir/$subdir/zerofill.c" "zerofill.o" object \
      "additional_flags=-fno-common"
  
  set size [ exec wc -c < zerofill.o ]
  
  if { $size < 100000 } {
      pass "zerofill"
  } else {
      fail "zerofill"
  }
  
  file delete zerofill.o
  
  # All done.
  dg-finish
  
  
  
  1.1                  gcc3/gcc/testsuite/gcc.apple/special/zerofill.c
  
  Index: zerofill.c
  ===================================================================
  /* APPLE LOCAL file zerofill */
  
  int arr[40000];
  
  foo() {}
  
  
  


Reply via email to