[test] Failing to build on Sun

Now that the Sun regression tests have started up again (with thanks to Noel Belcourt and Sandia), Boost.Test is failing to build on that platform: see http://tinyurl.com/ywm486 for an example but there are probably other errors as well. I wonder if this is as simple as missing the correct includes? Certainly to use ::perror you would need <stdio.h> rather than <cstdio> (as the latter only defines std::perror). I wonder if this is the cause of not finding snprintf as well? Thanks, John.

On 11/1/07, John Maddock <john@johnmaddock.co.uk> wrote:
Now that the Sun regression tests have started up again (with thanks to Noel Belcourt and Sandia), Boost.Test is failing to build on that platform: see http://tinyurl.com/ywm486 for an example but there are probably other errors as well.
I wonder if this is as simple as missing the correct includes? Certainly to use ::perror you would need <stdio.h> rather than <cstdio> (as the latter only defines std::perror). I wonder if this is the cause of not finding snprintf as well?
You are right. To use snprintf you have to include <stdio.h>. Current C++ standard does not require to put snprintf into the std namespace so Sun C++ does not do that. -- Simon Atanasyan

Simon Atanasyan wrote:
On 11/1/07, John Maddock <john@johnmaddock.co.uk> wrote:
Now that the Sun regression tests have started up again (with thanks to Noel Belcourt and Sandia), Boost.Test is failing to build on that platform: see http://tinyurl.com/ywm486 for an example but there are probably other errors as well.
I wonder if this is as simple as missing the correct includes? Certainly to use ::perror you would need <stdio.h> rather than <cstdio> (as the latter only defines std::perror). I wonder if this is the cause of not finding snprintf as well?
You are right. To use snprintf you have to include <stdio.h>. Current C++ standard does not require to put snprintf into the std namespace so Sun C++ does not do that.
Indeed, I've been able to reproduce the issue with Sun's Linux compiler, and added to change 40639 have added: # include <sys/time.h> # include <stdio.h> To the Unix-specific section of the header. Hopefully that'll fix things on Solaris as well. John.

John Maddock <john <at> johnmaddock.co.uk> writes:
Now that the Sun regression tests have started up again (with thanks to Noel Belcourt and Sandia), Boost.Test is failing to build on that platform: see http://tinyurl.com/ywm486 for an example but there are probably other errors as well.
I wonder if this is as simple as missing the correct includes? Certainly to use ::perror you would need <stdio.h> rather than <cstdio> (as the latter only defines std::perror). I wonder if this is the cause of not finding snprintf as well?
Can you add #if defined(__SUNPRO_CC) # include <stdio.h> #endif in BOOST_SUN_BASED_DEBUG section of debug.ipp configuration. I can do it later today. Gennadiy

Gennadiy Rozental wrote:
John Maddock <john <at> johnmaddock.co.uk> writes:
Now that the Sun regression tests have started up again (with thanks to Noel Belcourt and Sandia), Boost.Test is failing to build on that platform: see http://tinyurl.com/ywm486 for an example but there are probably other errors as well.
I wonder if this is as simple as missing the correct includes? Certainly to use ::perror you would need <stdio.h> rather than <cstdio> (as the latter only defines std::perror). I wonder if this is the cause of not finding snprintf as well?
Can you add
#if defined(__SUNPRO_CC) # include <stdio.h> #endif
in BOOST_SUN_BASED_DEBUG section of debug.ipp configuration. I can do it later today.
I committed a slightly different patch earlier today: http://svn.boost.org/trac/boost/changeset/40639/trunk/boost/test/impl/debug.... Note that regardless of the platform, <stdio.h> is required in order to use ::snprintf and all of <sys/stat.h>, <sys/wait.h> and <sys/time.h> is required to use ::select, so while it *may* be compiling on other platforms, it's kind of by accident, and these headers should really always be included when using those API's. HTH, John.
participants (3)
-
Gennadiy Rozental
-
John Maddock
-
Simon Atanasyan