bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test-func failure on Solaris


From: Bruno Haible
Subject: test-func failure on Solaris
Date: Thu, 27 Aug 2009 09:54:48 +0200
User-agent: KMail/1.9.9

On Solaris/x86, with SunPRO C 5.9, the test-func test fails. The reason
is that
     sizeof __func__
evaluates to 0. The compiler warns about it:
"test-func.c", line 40: warning: null dimension: sizeof()

What to do? m4/func.m4 could defined __func__ to a dummy. But that's too
much damage IMO. Better make clear that sizeof __func__ cannot be used
portably.

Simon, what do you think?


2009-08-27  Bruno Haible  <address@hidden>

        * tests/test-func.c (main): Don't verify sizeof __func__ on SunPRO C
        compilers.
        * doc/func.texi: Document the SunPRO C bug.

--- doc/func.texi.orig  2009-08-27 09:53:14.000000000 +0200
+++ doc/func.texi       2009-08-27 09:53:03.000000000 +0200
@@ -15,3 +15,6 @@
     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.orig      2009-08-27 09:46:28.000000000 +0200
+++ tests/test-func.c   2009-08-27 09:32:57.000000000 +0200
@@ -1,5 +1,5 @@
 /* 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;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]