diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2001-01-17 19:09:35 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2001-01-17 19:09:35 +0000 |
commit | 5f3aebeadf5ab4252900620f88a2159b2bafca3f (patch) | |
tree | 8d937e95bd8f29777d678324687bc0e7510fadf3 /gcc | |
parent | c7be4f66b05aeb98962fda3dcf84cb895262a639 (diff) | |
download | gcc-5f3aebeadf5ab4252900620f88a2159b2bafca3f.zip gcc-5f3aebeadf5ab4252900620f88a2159b2bafca3f.tar.gz gcc-5f3aebeadf5ab4252900620f88a2159b2bafca3f.tar.bz2 |
builtins1.C: New test.
* g++.old-deja/g++.other/builtins1.C: New test.
* g++.old-deja/g++.other/builtins2.C: Likewise.
* g++.old-deja/g++.other/builtins3.C: Likewise.
* g++.old-deja/g++.other/builtins4.C: Likewise.
From-SVN: r39095
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/builtins1.C | 33 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/builtins2.C | 40 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/builtins3.C | 39 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/builtins4.C | 39 |
5 files changed, 158 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc5f06..ab2f310 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2001-01-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * g++.old-deja/g++.other/builtins1.C: New test. + * g++.old-deja/g++.other/builtins2.C: Likewise. + * g++.old-deja/g++.other/builtins3.C: Likewise. + * g++.old-deja/g++.other/builtins4.C: Likewise. + 2001-01-17 Jakub Jelinek <jakub@redhat.com> * gcc.c-torture/compile/20010117-1.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins1.C b/gcc/testsuite/g++.old-deja/g++.other/builtins1.C new file mode 100644 index 0000000..b6cea1e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins1.C @@ -0,0 +1,33 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" __SIZE_TYPE__ strlen (const char *); +} + +int main () +{ + using namespace std; + + if (strlen ("hello") != 5) + abort (); + if (std::strlen ("hello") != 5) + abort (); + if (::__builtin_strlen ("hello") != 5) + abort (); + + return 0; +} + +extern "C" +{ + static __SIZE_TYPE__ ::strlen (const char *) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins2.C b/gcc/testsuite/g++.old-deja/g++.other/builtins2.C new file mode 100644 index 0000000..48e53f1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins2.C @@ -0,0 +1,40 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" char *strcpy (char *, const char *); + extern "C" int memcmp (const void *, const void *, __SIZE_TYPE__); +} + +int main () +{ + using namespace std; + char f[16]; + + if (strcpy (f, "hello world") != f + || memcmp (f, "hello world", sizeof ("hello world"))) + abort (); + + if (std::strcpy (f, "bye world") != f + || memcmp (f, "bye world", sizeof ("bye world"))) + abort (); + + if (::__builtin_strcpy (f, "hello world") != f + || memcmp (f, "hello world", sizeof ("hello world"))) + abort (); + + return 0; +} + +extern "C" +{ + static char * ::strcpy (char *, const char *) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins3.C b/gcc/testsuite/g++.old-deja/g++.other/builtins3.C new file mode 100644 index 0000000..4a67b28 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins3.C @@ -0,0 +1,39 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" void *alloca (__SIZE_TYPE__); +} + +int main () +{ + using namespace std; + void *foo; + + foo = alloca (32); + if (!foo) + abort (); + + foo = std::alloca (32); + if (!foo) + abort (); + + foo = ::__builtin_alloca (32); + if (!foo) + abort (); + + return 0; +} + +extern "C" +{ + static void * ::alloca (__SIZE_TYPE__) + { + std::abort (); + } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/builtins4.C b/gcc/testsuite/g++.old-deja/g++.other/builtins4.C new file mode 100644 index 0000000..7118910 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/builtins4.C @@ -0,0 +1,39 @@ +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// +// Special g++ Options: -O2 + +namespace std +{ + extern "C" void abort (void); + extern "C" int printf (const char *, ...); +} + +int main () +{ + using namespace std; + + printf ("hello world\n"); + printf ("\n"); + printf ("%s\n", "hello world"); + printf ("%c", '\n'); + std::printf ("hello world\n"); + std::printf ("\n"); + std::printf ("%s\n", "hello world"); + std::printf ("%c", '\n'); + ::__builtin_printf ("hello world\n"); + ::__builtin_printf ("\n"); + ::__builtin_printf ("%s\n", "hello world"); + ::__builtin_printf ("%c", '\n'); + + return 0; +} + +extern "C" +{ + static int ::printf (const char *, ...) + { + std::abort (); + } +} |