From: Jeffrey A Law Date: Thu, 26 Apr 2001 20:06:25 +0000 (+0000) Subject: initp1.C: Moved here from g++.old-deja/g++.ext. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a86414f3625a551945d5cdf7f770d74d7404afa3;p=gcc.git initp1.C: Moved here from g++.old-deja/g++.ext. * g++.dg/special/initp1.C: Moved here from g++.old-deja/g++.ext. Tweak slightly to work with g++.dg framework. * g++.dg/special/ecos.exp: Run initp1.C test. * g++.old-deja/g++.ext/initp1.C: Moved to g++.dg/special. From-SVN: r41610 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8839c39125e..640a2d6d7d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ Thu Apr 26 11:15:12 2001 Jeffrey A Law (law@cygnus.com) + * g++.dg/special/initp1.C: Moved here from g++.old-deja/g++.ext. + Tweak slightly to work with g++.dg framework. + * g++.dg/special/ecos.exp: Run initp1.C test. + * g++.old-deja/g++.ext/initp1.C: Moved to g++.dg/special. + * g++.old-deja/g++.ext/instantiate2.C: XFAIL for HPUX too since its linker doesn't give line numbers either. * g++.old-deja/g++.ext/instantiate3.C: Similarly. diff --git a/gcc/testsuite/g++.dg/special/ecos.exp b/gcc/testsuite/g++.dg/special/ecos.exp index 8d3ec90a01a..df94956c19e 100644 --- a/gcc/testsuite/g++.dg/special/ecos.exp +++ b/gcc/testsuite/g++.dg/special/ecos.exp @@ -84,5 +84,22 @@ if [string match "*init_priority*" $lines] then { } dg-finish +########### +# initp1.C +########### + +dg-init +set lines [g++_target_compile "$srcdir/$subdir/initp1.C" "$objdir/a.out" executable ""] +if [string match "*init_priority*" $lines] then { + xfail "initp1.C" + file delete $objdir/a.out +} elseif ![string match "" $lines] then { + fail "initp1.C" +} else { + dg-runtest "$srcdir/$subdir/conpr-1.C" "" "" + file delete $objdir/a.out +} +dg-finish + ### EOF ecos.exp diff --git a/gcc/testsuite/g++.dg/special/initp1.C b/gcc/testsuite/g++.dg/special/initp1.C new file mode 100644 index 00000000000..74bcb5f764d --- /dev/null +++ b/gcc/testsuite/g++.dg/special/initp1.C @@ -0,0 +1,90 @@ +/* { dg-do run } */ +#include + +class Two { +private: + int i, j, k; +public: + static int count; + Two( int ii, int jj ) { i = ii; j = jj; k = count++; }; + Two( void ) { i = 0; j = 0; k = count++; }; + int eye( void ) { return i; }; + int jay( void ) { return j; }; + int kay( void ) { return k; }; +}; + +extern Two foo; +extern Two goo; +extern Two coo[]; +extern Two koo[]; + +Two foo( 5, 6 ) __attribute__((init_priority(1005))); + +Two goo __attribute__((init_priority(1007))) = Two( 7, 8 ); + +Two doo[ 3 ]; + +Two hoo[ 3 ] = { + Two( 11, 12 ), + Two( 13, 14 ), + Two( 15, 16 ) +}; + +Two coo[ 3 ] __attribute__((init_priority(1000))); + +Two koo[ 3 ] __attribute__((init_priority(1000))) = { + Two( 21, 22 ), + Two( 23, 24 ), + Two( 25, 26 ) +}; + +Two xoo[ 3 ] __attribute__((init_priority(1100))); + +Two zoo[ 3 ] __attribute__((init_priority(1100))) = { + Two( 31, 32 ), + Two( 33, 34 ), + Two( 35, 36 ) +}; + +int Two::count; + +int x = 0; + +#define X( n ) \ + do { if ( x & (1 << (n)) ) return 1; else x |= (1 << (n)); } while (0) + +int main() +{ + + X( coo[0].kay() ); + X( coo[1].kay() ); + X( coo[2].kay() ); + X( koo[0].kay() ); + X( koo[1].kay() ); + X( koo[2].kay() ); + if ( 0x3f != x ) abort (); + + X( foo.kay() ); + if ( 0x7f != x ) abort (); + + X( goo.kay() ); + if ( 0xff != x ) abort (); + + X( xoo[0].kay() ); + X( xoo[1].kay() ); + X( xoo[2].kay() ); + X( zoo[0].kay() ); + X( zoo[1].kay() ); + X( zoo[2].kay() ); + if ( 0x3fff != x ) abort (); + + X( doo[0].kay() ); + X( doo[1].kay() ); + X( doo[2].kay() ); + X( hoo[0].kay() ); + X( hoo[1].kay() ); + X( hoo[2].kay() ); + if ( 0xfffff != x ) abort (); + + exit (0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/initp1.C b/gcc/testsuite/g++.old-deja/g++.ext/initp1.C deleted file mode 100644 index 0e4c02c3c0d..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.ext/initp1.C +++ /dev/null @@ -1,91 +0,0 @@ -// Test for proper handling of the init_priority attribute. -// Contributed by Hugo Tyson -// excess errors test - XFAIL mips*-sgi-irix* - -class Two { -private: - int i, j, k; -public: - static int count; - Two( int ii, int jj ) { i = ii; j = jj; k = count++; }; - Two( void ) { i = 0; j = 0; k = count++; }; - int eye( void ) { return i; }; - int jay( void ) { return j; }; - int kay( void ) { return k; }; -}; - -extern Two foo; -extern Two goo; -extern Two coo[]; -extern Two koo[]; - -Two foo( 5, 6 ) __attribute__((init_priority(1005))); - -Two goo __attribute__((init_priority(1007))) = Two( 7, 8 ); - -Two doo[ 3 ]; - -Two hoo[ 3 ] = { - Two( 11, 12 ), - Two( 13, 14 ), - Two( 15, 16 ) -}; - -Two coo[ 3 ] __attribute__((init_priority(1000))); - -Two koo[ 3 ] __attribute__((init_priority(1000))) = { - Two( 21, 22 ), - Two( 23, 24 ), - Two( 25, 26 ) -}; - -Two xoo[ 3 ] __attribute__((init_priority(1100))); - -Two zoo[ 3 ] __attribute__((init_priority(1100))) = { - Two( 31, 32 ), - Two( 33, 34 ), - Two( 35, 36 ) -}; - -int Two::count; - -int x = 0; - -#define X( n ) \ - do { if ( x & (1 << (n)) ) return 1; else x |= (1 << (n)); } while (0) - -int main() -{ - - X( coo[0].kay() ); - X( coo[1].kay() ); - X( coo[2].kay() ); - X( koo[0].kay() ); - X( koo[1].kay() ); - X( koo[2].kay() ); - if ( 0x3f != x ) return 1; - - X( foo.kay() ); - if ( 0x7f != x ) return 1; - - X( goo.kay() ); - if ( 0xff != x ) return 1; - - X( xoo[0].kay() ); - X( xoo[1].kay() ); - X( xoo[2].kay() ); - X( zoo[0].kay() ); - X( zoo[1].kay() ); - X( zoo[2].kay() ); - if ( 0x3fff != x ) return 1; - - X( doo[0].kay() ); - X( doo[1].kay() ); - X( doo[2].kay() ); - X( hoo[0].kay() ); - X( hoo[1].kay() ); - X( hoo[2].kay() ); - if ( 0xfffff != x ) return 1; - - return 0; -}