* assert.cc (__assert_func): New function, to match newlib header

change.
	* cygwin.din: Export __assert_func.
	* include/cygwin/version.h: Bump API minor number.
This commit is contained in:
Eric Blake
2007-06-27 12:46:35 +00:00
parent 3473e6bd7b
commit 048e00e01d
4 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/* assert.cc: Handle the assert macro for WIN32.
Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
Copyright 1997, 1998, 2000, 2001, 2007 Red Hat, Inc.
This file is part of Cygwin.
@ -22,6 +22,13 @@ details. */
extern "C" void
__assert (const char *file, int line, const char *failedexpr)
{
__assert_func (file, line, NULL, failedexpr);
}
extern "C" void
__assert_func (const char *file, int line, const char *func,
const char *failedexpr)
{
HANDLE h;
@ -35,15 +42,17 @@ __assert (const char *file, int line, const char *failedexpr)
char *buf;
buf = (char *) alloca (100 + strlen (failedexpr));
__small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
failedexpr, line, file);
__small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s%s%s",
failedexpr, line, file,
func ? "\nin function " : "", func ? func : "");
MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
}
else
{
CloseHandle (h);
small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
small_printf ("assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
failedexpr, file, line,
func ? ", function: " : "", func ? func : "");
}
#ifdef DEBUGGING