Commit 5f3aebea by Kaveh R. Ghazi Committed by Kaveh Ghazi

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
parent c7be4f66
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.
......
// 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 ();
}
}
// 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 ();
}
}
// 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 ();
}
}
// 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 ();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment