Commit e2b97aca authored by Bruno Haible's avatar Bruno Haible
Browse files

Avoid sizeof __func__ == 0 pitfall.

parent 50e6714c
2009-08-27 Bruno Haible <>
* tests/test-func.c (main): Don't verify sizeof __func__ on SunPRO C
* doc/func.texi: Document the SunPRO C bug.
2009-08-27 Bruno Haible <>
Fix link error on Solaris.
......@@ -15,3 +15,6 @@ int main (void)
printf ("%s: hello world\n", __func__);
@end smallexample
Note that @code{sizeof} cannot be applied to @code{__func__}: On SunPRO C
compiler, @code{sizeof __func__} evaluates to 0.
/* Test whether __func__ is available
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -37,6 +37,13 @@
main ()
ASSERT (strlen (__func__) > 0);
/* On SunPRO C 5.9, sizeof __func__ evaluates to 0. The compiler warns:
"warning: null dimension: sizeof()". */
#if !defined __SUNPRO_C
ASSERT (strlen (__func__) + 1 == sizeof __func__);
return 0;
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