Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
gnulib
Commits
e2b97aca
Commit
e2b97aca
authored
Aug 27, 2009
by
Bruno Haible
Browse files
Avoid sizeof __func__ == 0 pitfall.
parent
50e6714c
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e2b97aca
2009-08-27 Bruno Haible <bruno@clisp.org>
* tests/test-func.c (main): Don't verify sizeof __func__ on SunPRO C
compilers.
* doc/func.texi: Document the SunPRO C bug.
2009-08-27 Bruno Haible <bruno@clisp.org>
Fix link error on Solaris.
doc/func.texi
View file @
e2b97aca
...
...
@@ -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.
tests/test-func.c
View file @
e2b97aca
/* 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 @@
int
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__
);
#endif
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment