From 186071821a5c388da21ab0a53f41dfb0eea24cf7 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 27 Oct 2001 20:11:10 +0000 Subject: Only provide function information in compile environments that support the C99 variable __func__ and never for C++. Provide a more meaningful example in the assert(3) manual. Reviewed by: asmodai, bde --- lib/libc/gen/assert.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/assert.c b/lib/libc/gen/assert.c index 9f265b7..7cd4d0c 100644 --- a/lib/libc/gen/assert.c +++ b/lib/libc/gen/assert.c @@ -45,14 +45,19 @@ __FBSDID("$FreeBSD$"); #include void -__assert(function, file, line, failedexpr) - const char *function, *file; +__assert(func, file, line, failedexpr) + const char *func, *file; int line; const char *failedexpr; { - (void)fprintf(stderr, - "assertion (%s) failed: function %s(), file %s:%d\n", - failedexpr, function, file, line); + if (func == NULL) + (void)fprintf(stderr, + "assertion (%s) failed: file %s:%d\n", failedexpr, + file, line); + else + (void)fprintf(stderr, + "assertion (%s) failed: function %s(), file %s:%d\n", + failedexpr, func, file, line); abort(); /* NOTREACHED */ } -- cgit v1.1