OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gcc-4.5.1/gcc-4.5.1-or32-1.0rc1/gcc/testsuite/g++.old-deja/g++.ext
    from Rev 305 to Rev 338
    Reverse comparison

Rev 305 → Rev 338

/arrnew.C
0,0 → 1,8
// { dg-do assemble }
// { dg-options "" }
// PRMS Id: 4992
 
int *f(){
return new int[1] = { 1 }; // { dg-error "lvalue" "err" }
// { dg-warning "extended init" "warn" { target *-*-* } 6 }
}
arrnew.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array1.C =================================================================== --- array1.C (nonexistent) +++ array1.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// { dg-options "" } +// Testcase for assignment of non-array to array (assigns the same value to +// each member) +// Special Options: + +typedef struct {} ct2d_rigid, ct2d_rigid_a[1]; +class ccInspection +{ +protected: + ct2d_rigid_a _dev2phys; +}; +class ccBgaInspection : public ccInspection +{ +public: + void reinspect (unsigned long diagFlags); +}; +void +ccBgaInspection::reinspect (unsigned long diag_flags) +{ + ct2d_rigid physTdev; + _dev2phys = physTdev; // { dg-error "" } +}
array1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array2.C =================================================================== --- array2.C (nonexistent) +++ array2.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-w" } +// This testcase used to cause a crash on the Alpha. + +struct A { + int i; + ~A() { } +}; + +A f (int n) +{ + A a[n]; +}
array2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: return1.C =================================================================== --- return1.C (nonexistent) +++ return1.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } +// Test that the named return value extension works when passed as a reference. +// Origin: Jason Merrill + +void f (int &i) +{ + i = 42; +} + +int g () return r // { dg-error "" } named return value +{ + f (r); // { dg-error "" } undeclared +} + +int main () +{ + int i = g (); + return (i != 42); +}
return1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array3.C =================================================================== --- array3.C (nonexistent) +++ array3.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +void *vp; + +void f () +{ + int i = (*((int (*)[i]) vp))[0]; +}
array3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array4.C =================================================================== --- array4.C (nonexistent) +++ array4.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "" } + + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Mark Mitchell 19 Mar 2000 +// Nathan Sidwell 19 Mar 2000 + +// [nathan] We have a zero sized array extension, and (unfortunately) allow it +// to be the sole member of a struct (rather than the trailing member of a +// non-empty struct as C99 is/will allow). Such a type will have a size of +// zero, but is not incomplete. + +struct A +{ + int m[0]; +}; + +void foo () +{ + A a; +} + +template +struct S +{ + int x[0]; +}; + +template struct S; +
array4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: typename1.C =================================================================== --- typename1.C (nonexistent) +++ typename1.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do run } +// Bug: g++ forgets about the instantiation of class1 when looking up +// class11_value, and tries to look things up in class1. + +template +struct class1 { + struct class11 { + typedef ItIsInt class11_value; + }; +}; + +template +struct class3 { + int f(); +}; + +template +int class3::f() +{ + return typename class1::class11::class11_value(10); +} + +struct class2 { + typedef int class2_value; +}; + +int main() +{ + class3 the_class3; + the_class3.f(); +}
typename1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: noweak1.C =================================================================== --- noweak1.C (nonexistent) +++ noweak1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fno-weak" } +// Test that -fno-weak doesn't break explicit instantiation of static data. + +template struct A +{ + static int i; +}; + +template int A::i = 42; + +template class A; + +int main () +{ + return (A::i != 42); +}
noweak1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: anon1.C =================================================================== --- anon1.C (nonexistent) +++ anon1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "" } + +union U { + struct { int i; int j; }; + int a[2]; +}; + +int main () +{ + U u; + u.i = 42; + u.a[1] = 24; + return u.j != 24 || u.a[0] != 42; +}
anon1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: anon2.C =================================================================== --- anon2.C (nonexistent) +++ anon2.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "" } + +struct S +{ + S (); +}; + +union U { + struct { + S s; // { dg-error "" } struct with constructor in union + }; +}; +
anon2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: anon3.C =================================================================== --- anon3.C (nonexistent) +++ anon3.C (revision 338) @@ -0,0 +1,36 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 6 Jun 2001 + +// Bug 2914. New types can be created in a static member +// initializer. These should not be injected into the member's class's +// scope. + +class DoubleSupport +{ + public: + static void toDouble(); + + static const double s_NaN; + static const double s_positiveInfinity; + static const double s_negativeInfinity; + static const double s_positiveZero; + static const double s_negativeZero; + static const unsigned long* s_NaNFirstDWORD; + static const unsigned long* s_NaNSecondDWORD; +}; + +const double DoubleSupport::s_positiveInfinity = +(__extension__ ((union { unsigned char __c[8]; double __d; }) + { __c: { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }).__d); + +struct other +{ +}; + + +void +DoubleSupport::toDouble() +{ +}
anon3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: arrnew2.C =================================================================== --- arrnew2.C (nonexistent) +++ arrnew2.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do run { xfail *-*-* } } +// { dg-options "-w -fpermissive" } + +int *foo = new int[1](42); // { dg-bogus "" } +int main () +{ + return foo[0] != 42; +}
arrnew2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: restrict1.C =================================================================== --- restrict1.C (nonexistent) +++ restrict1.C (revision 338) @@ -0,0 +1,60 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 1999 +// Test our restrict object pointer extension + +struct A +{ + void f1() __restrict__; + void g1(int *__restrict__); + void f2() __restrict__; + void g2(int *__restrict__); + void f3(); + void g3(int *); + void f4(); + void g4(int *); +}; + +void A::f1 () __restrict__ {} +void A::g1 (int *__restrict__) {} + +void A::f2 () {} +void A::g2 (int *) {} + +void A::f3 () __restrict__ {} +void A::g3 (int *__restrict__) {} + +void A::f4 () {} +void A::g4 (int *) {} + +template struct X +{ + void f1() __restrict__; + void g1(int *__restrict__); + void f2() __restrict__; + void g2(int *__restrict__); + void f3(); + void g3(int *); + void f4(); + void g4(int *); +}; + +template void X::f1 () __restrict__ {} +template void X::g1 (int *__restrict__) {} +template void X::f2 () {} +template void X::g2 (int *) {} +template void X::f3 () __restrict__ {} +template void X::g3 (int *__restrict__) {} +template void X::f4 () {} +template void X::g4 (int *) {} + +void fn () +{ + X g; + + g.f1 (); + g.f2 (); + g.f3 (); + g.f4 (); +}
restrict1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: default.C =================================================================== --- default.C (nonexistent) +++ default.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// PRMS Id: 5353 +// This may be an extension, but it's a very common one... + +extern "C" int printf (const char *, ...); + +class A { +public: + static A*func (int = 3); + static A*(*ptr)(int = 4); // { dg-error "" } .* +}; + +A*(*A::ptr)(int) = &A::func; + +int main() +{ + A foo; + + A::ptr(); // { dg-error "" } .* + A::ptr(47); +} + +A*A::func(int i) +{ + printf("I = %d\n",i); + return (A*)0; +}
default.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: memconst.C =================================================================== --- memconst.C (nonexistent) +++ memconst.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// { dg-options "" } +// From: Ove.Ewerlid@syscon.uu.se (Ove Ewerlid) +// Subject: ss-940630:cc1plus: internal error +// Date: Sat, 2 Jul 1994 05:07:20 +0200 + +class qwerty { +public: + qwerty (const unsigned short userkey[8]); + ~qwerty (); +}; + +class foo { +private: + static const unsigned char * const dummy_key = (unsigned char*)"ThisIs a dummy!"; // { dg-error "" } + +public: + void bar (); +}; + +void +foo::bar () +{ + qwerty QWERTY ((unsigned short*)dummy_key); // { dg-error "" } +}
memconst.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: delvoid.C =================================================================== --- delvoid.C (nonexistent) +++ delvoid.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do run } +// { dg-options "-w" } +// Jason Merrill +// Test for deleting a void pointer, which the standard says is undefined, +// but which is used by several free C++ programs. + +void *p; + +int main () +{ + delete [] p; +}
delvoid.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bound1.C =================================================================== --- bound1.C (nonexistent) +++ bound1.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do assemble } +// { dg-options "-Wno-pmf-conversions" } +// Testcase for cast of bound pointer to member function. + +struct A { + int f (); +}; + +typedef int (*fptr)(A *); +typedef void* vptr; +typedef int (A::*pmf)(); + +void foo (A* ap, pmf fp, int A::* ip) +{ + fptr p; + vptr q; + A a; + + p = (fptr)(ap->*fp); + p = (fptr)(ap->*fp); + p = (fptr)(ap->*(&A::f)); + p = (fptr)(a.*fp); + p = (fptr)(a.*(&A::f)); + + q = (vptr)(ap->*fp); + q = (vptr)(ap->*(&A::f)); + q = (vptr)(a.*fp); + q = (vptr)(a.*(&A::f)); +}
bound1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: overload1.C =================================================================== --- overload1.C (nonexistent) +++ overload1.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-fpermissive" } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Feb 2001 + +// Make sure we warn about our overload extension about picking the +// one with the least worse conversion + +struct X +{ + X (int); +}; +void Foo (int, float, bool); // { dg-message "candidate" } +void Foo (float, int, X); // { dg-message "candidate" } + +void Baz () +{ + Foo (1, 1, 0); // { dg-warning "worst" } +}
overload1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: syshdr1.C =================================================================== --- syshdr1.C (nonexistent) +++ syshdr1.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "" } +// Test that we don't complain about trying to define bool or wchar_t in a +// system header. + + +# 1 "syshdr1.C" +# 1 "syshdr1.h" 1 3 +typedef int bool; +typedef int wchar_t; +# 2 "syshdr1.C" 2
syshdr1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: label1.C =================================================================== --- label1.C (nonexistent) +++ label1.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do run } +// { dg-options "" } +// Origin: Mark Mitchell + +int main () +{ + int i = 0; + int j = 0; + int k = 0; + + l: + if (j) + return 0; + ({ + __label__ l; + k = 0; + l: + if (++k <= 2) + goto l; + ++i;}); + if (i > 1 || k != 3) + return 1; + else + { + j = 1; + goto l; + } +}
label1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: label2.C =================================================================== --- label2.C (nonexistent) +++ label2.C (revision 338) @@ -0,0 +1,35 @@ +// { dg-do run } +// { dg-options "" } +// Origin: Mark Mitchell + +template +int f () +{ + int i = 0; + int j = 0; + int k = 0; + + l: + if (j) + return 0; + ({ + __label__ l; + k = 0; + l: + if (++k <= 2) + goto l; + ++i;}); + if (i > 1 || k != 3) + return 1; + else + { + j = 1; + goto l; + } +} + +int main () +{ + return f(); +} +
label2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib1.C =================================================================== --- attrib1.C (nonexistent) +++ attrib1.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test for using prefix attributes in a parameter decl. +// Contributed by Jason Merrill + +#define _stdcall __attribute__ ((__stdcall__)) + +typedef void (_stdcall* pfn)(); + +void f (void (_stdcall*) ()); +void f (void (_stdcall* pfn)());
attrib1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: stmtexpr1.C =================================================================== --- stmtexpr1.C (nonexistent) +++ stmtexpr1.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +void f () +{ + int i = ({ l: 3; }); +}
stmtexpr1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib2.C =================================================================== --- attrib2.C (nonexistent) +++ attrib2.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test that stdcall doesn't prevent us from using op delete. +// Contributed by Jason Merrill + +struct A { + void operator delete (void *) __attribute__ ((stdcall)); +}; + +void A::operator delete (void *) { } + +int main() +{ + A* ap = new A; + delete ap; +}
attrib2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: addrfunc1.C =================================================================== --- addrfunc1.C (nonexistent) +++ addrfunc1.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fms-extensions" } +// Test that taking the address of a member function name produces +// a pointer to member function. +// Contributed by Jason Merrill + +struct A { }; +int (A::*p)(); + +struct B { + int f () { return 0; } + void g (); +}; + +void B::g () +{ + p = (int (A::*)())&f; +}
addrfunc1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: addrfunc2.C =================================================================== --- addrfunc2.C (nonexistent) +++ addrfunc2.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fms-extensions" } +// Test for implicit & on methods. +// Contributed by Jason Merrill . + +struct A { + void f (int = 0) { } +}; + +int +main () +{ + void (A::*p)(int) = 0; + p = A::f; + if (p != A::f) + return 1; +}
addrfunc2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib3.C =================================================================== --- attrib3.C (nonexistent) +++ attrib3.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// Test for proper handling of attributes in template instantiation. +// Contributed by Jason Merrill + +template +struct A { + static void f () __attribute__ ((stdcall)); +}; + +template void +A::f () { } + +void g (void (__attribute__ ((stdcall)) *p)()) { } +void g (int); + +int +main () +{ + g (&A::f); +}
attrib3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pretty2.C =================================================================== --- pretty2.C (nonexistent) +++ pretty2.C (revision 338) @@ -0,0 +1,85 @@ +// { dg-do run } +// Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions + +#include +#include + +static bool bad = false; + +struct X +{ + X (); + ~X (); + void fn (); + operator int (); +}; + +X::X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("ctor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "X")) + bad = true; + if (strcmp (pretty, "X::X()")) + bad = true; +} +X::~X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("dtor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "~X")) + bad = true; + if (strcmp (pretty, "X::~X()")) + bad = true; +} +void X::fn () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("member fn\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "fn")) + bad = true; + if (strcmp (pretty, "void X::fn()")) + bad = true; +} +X::operator int () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("conversion\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (pretty, "X::operator int()")) + bad = true; + return 0; +} + +int main () +{ + { + X x; + + x.fn (); + (void)int (x); + } + return bad; +}
pretty2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: addrfunc3.C =================================================================== --- addrfunc3.C (nonexistent) +++ addrfunc3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-options "-fpermissive -w" } +// Test for overload resolution in comparison expressions. +// Contributed by Jason Merrill . + +void f (int) { } +void f (); + +int main () { + void (*p)(int); + p = f; + if (p != f) + return 1; +}
addrfunc3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib4.C =================================================================== --- attrib4.C (nonexistent) +++ attrib4.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-Wformat" } +// Test that attributes are really applied to function declarations under +// various conditions. +// Contributed by Jason Merrill (jason@cygnus.com) + +#define PF __attribute__ ((format (printf, 1, 2))) + +struct A { + static PF void f (const char *, ...); + static PF void g (const char *, ...) { } + static void test (); +}; + +void PF h (const char *, ...); +void PF k (const char *, ...) { } + +void A::test () +{ + f ("%f", 42); // { dg-warning "argument 2" } + g ("%f", 42); // { dg-warning "argument 2" } + h ("%f", 42); // { dg-warning "argument 2" } + k ("%f", 42); // { dg-warning "argument 2" } +}
attrib4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: addrfunc4.C =================================================================== --- addrfunc4.C (nonexistent) +++ addrfunc4.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-fms-extensions" } +// Test that an object-dependent reference to a member function can be +// used to produce a pointer to member function, as in VC++. +// Contributed by Jason Merrill + +struct A +{ + int f(int a) { return 0; } + void f(int a, int b) { } +}; + +typedef int (A::* pmf1)(int); +typedef void (A::* pmf2)(int, int); + +int main() +{ + A a; + pmf1 fn1; + pmf2 fn2; + + fn1 = a.f; + fn1 = (pmf1)a.f; + fn2 = (pmf2)a.f; +}
addrfunc4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib5.C =================================================================== --- attrib5.C (nonexistent) +++ attrib5.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do run { xfail alpha*-dec-osf* i?86-pc-cygwin } } +// Test that attributes weak and alias coexist. +// { dg-require-weak "" } +// { dg-require-alias "" } + +extern "C" { + void _f () { } + void f () __attribute__((weak, alias ("_f"))); +} + +int main () +{ + f (); +}
attrib5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pretty3.C =================================================================== --- pretty3.C (nonexistent) +++ pretty3.C (revision 338) @@ -0,0 +1,47 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates + +#include +#include + +static bool bad = false; + +template void f1 (T) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("generic\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1(T) [with T = float]")) // only for float instantiation + bad = true; +} + +template<> void f1 (int) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("specialized\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1(T) [with T = int]")) + bad = true; +} + +int main () +{ + f1(0); // f1 + f1(0.0f); // f1 + return bad; +}
pretty3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib6.C =================================================================== --- attrib6.C (nonexistent) +++ attrib6.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Test that postfix attributes only apply to a single declared object. +// (decl_attributes used to chain them onto the end of the prefix attributes, +// which caused them to apply to other declarations as well.) +// Origin: Joseph Myers . +void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void);
attrib6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pretty4.C =================================================================== --- pretty4.C (nonexistent) +++ pretty4.C (revision 338) @@ -0,0 +1,85 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Mar 2000 + +// __PRETTY_FUNCTION__, __FUNCTION__ and __function__ should have the +// type char const [X], where X is the right value for that particular function + +static void const *strings[4]; +static void const *tpls[4]; +static unsigned pos = 0; +static int fail; +static void const *ptr = 0; + +void unover (char const (*)[5]) {} +void foo (char const (*)[5]) {} +void foo (void *) {fail = 1;} +void foo (void const *) {fail = 1;} +void baz (char const (&)[5]) {} + +template void PV (char const (&objRef)[I]) +{ + strings[pos] = objRef; + tpls[pos] = __PRETTY_FUNCTION__; + pos++; +} + +void fn () +{ + PV (__FUNCTION__); + PV (__func__); + PV (__PRETTY_FUNCTION__); + PV ("wibble"); +} + +void baz () +{ + ptr = __FUNCTION__; + // there should be no string const merging + if (ptr == "baz") + fail = 1; + // but all uses should be the same. + if (ptr != __FUNCTION__) + fail = 1; +} +int baz (int) +{ + return ptr == __FUNCTION__; +} + +int main () +{ + // make sure we actually emit the VAR_DECL when needed, and things have the + // expected type. + foo (&__FUNCTION__); + baz (__FUNCTION__); + unover (&__FUNCTION__); + if (fail) + return 1; + + // __FUNCTION__ should be unique across functions with the same base name + // (it's a local static, _not_ a string). + baz (); + if (fail) + return 1; + if (baz (1)) + return 1; + fn (); + + // Check the names of fn. They should all be distinct strings (though two + // will have the same value). + if (strings[0] == strings[1]) + return 1; + if (strings[0] == strings[2]) + return 1; + if (strings[1] == strings[2]) + return 1; + + // check the names of the template functions so invoked + if (tpls[0] != tpls[1]) + return 1; + if (tpls[0] == tpls[2]) + return 1; + + return 0; +}
pretty4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asmspec1.C =================================================================== --- asmspec1.C (nonexistent) +++ asmspec1.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble { target i?86-*-* x86_64-*-* } } +// Origin: Anthony Green + +void foo () +{ + register const char *h asm("%esi") = "hey"; +}
asmspec1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: namedret1.C =================================================================== --- namedret1.C (nonexistent) +++ namedret1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } + +int f(int x) return y(x) { } // { dg-error "" } + +extern "C" void abort (); + +int main() +{ + if (f(1) != 1 || f(2) != 2 || f(3) != 3) + abort (); + return 0; +}
namedret1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: namedret2.C =================================================================== --- namedret2.C (nonexistent) +++ namedret2.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble { target alpha*-*-* } } +// { dg-options "-Wno-deprecated" } + +// This test verifies that return type promotion is working correctly. +// The Alpha ABI specifies that 32-bit return values have bit 31 propagated, +// i.e. the value is sign-extended even if the unpromoted type is unsigned. + +unsigned int f(unsigned int x) return y(x) { } // { dg-error "" } + +extern "C" void abort (); + +int main() +{ + typedef long (*long_func)(long); + long_func g = reinterpret_cast(f); + + if (g(-1L) != -1L) + abort (); + return 0; +}
namedret2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: namedret3.C =================================================================== --- namedret3.C (nonexistent) +++ namedret3.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "-Wno-deprecated" } + +extern "C" void abort(); + +int f2(int *x) +{ + *x = 1; + return 2; +} + +int f1() return x // { dg-error "" } +{ + f2(&x); // { dg-error "" } +} + +void g() +{ + int scratch[100]; + int i; + for (i = 0; i < 100; ++i) + scratch[i] = 0; +} + +int main() +{ + g(); + if (f1() != 1) + abort (); + return 0; +}
namedret3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: constructor.C =================================================================== --- constructor.C (nonexistent) +++ constructor.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-options "" } +// Testcase for constructor expressions (GNU extension) + +struct Any { + int *type; + int *addr; +}; + +int i, j; + +main () { + struct Any *ap = (struct Any *) + __builtin_alloca (sizeof(struct Any)); + *ap = ((struct Any){ &i, &j }) ; + + if (ap->type != &i || ap->addr != &j) + return 1; + return 0; +}
constructor.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pretty.C =================================================================== --- pretty.C (nonexistent) +++ pretty.C (revision 338) @@ -0,0 +1,42 @@ +// { dg-do assemble } +// Test for PRETTY_FUNCTION + +class SV; + +class SVTable // : public Debug +{ + // It is an array to pointer to a SV. + SV ** array; + + // This is the size of array. + int maxCount; + + // This is the current element count. + int count; + + void fatal_error (const char *f, ...); + +public: + SVTable (int size, const char *d); + SVTable (); + SVTable (const SVTable &); + ~SVTable () {} + +}; + + +SVTable::SVTable (int size, const char *d) + : maxCount (size), count (0)// , Debug (d) +{ + if (size < 0) + { + fatal_error ("%s: Invalid size: %d\n", __PRETTY_FUNCTION__, size); + } + + array = (SV **) new SV * [size]; + + if (array == 0) + { + fatal_error ("%s: Failed to allocate array\n", __PRETTY_FUNCTION__); + } +}
pretty.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: typeof1.C =================================================================== --- typeof1.C (nonexistent) +++ typeof1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +struct inttest { + int elem[1]; +}; + +template +void F(T x) +{ + typedef __typeof (x.elem[0]) dummy; + dummy i = 1; +} + +int main() { + inttest x; + F(x); +}
typeof1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: typeof2.C =================================================================== --- typeof2.C (nonexistent) +++ typeof2.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + int i; + __typeof( S::i ) f (); +};
typeof2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: null1.C =================================================================== --- null1.C (nonexistent) +++ null1.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do run } +// Test for overloading with g++ NULL. + +void f (int *) { } +void f (char, char); +int main () +{ + f (__null); +}
null1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: jump1.C =================================================================== --- jump1.C (nonexistent) +++ jump1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-options "-fpermissive -w" } +// Test that we can jump over the declaration of a non-POD object. +// Contributed by Jason Merrill + +struct A { }; +union U { + void (A::*p)(); +}; + +int main() +{ + goto foo; + U u; + foo: + return 0; +}
jump1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.