Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3558 closed Bugs (wontfix)

como throws error: the global scope has no snprintf

Reported by: mloskot <mateusz@…> Owned by: Gennadiy Rozental
Milestone: Boost 1.41.0 Component: test
Version: Boost Development Trunk Severity: Problem
Keywords: como, comeau Cc:

Description

Building Boost.Test from trunk (r57142) using Comeau C/C++ 4.3.10.1 gives errors about missing snprintf function:

como-linux.compile.c++ ../../bin.v2/libs/test/build/como-linux/debug/debug.o
Comeau C/C++ 4.3.10.1 (May  7 2008 12:23:21) for LINUX_INTEL_ELF_Beta
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:non-strict warnings C++ noC++0x_extensions

"../../boost/test/impl/debug.ipp", line 320: error: the global scope has no
          "snprintf"
      ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid );
        ^

"../../boost/test/impl/debug.ipp", line 420: error: the global scope has no
          "snprintf"
      ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
        ^

"../../boost/test/impl/debug.ipp", line 426: error: the global scope has no
          "mkstemp"
      fd_holder cmd_fd( ::mkstemp( cmd_file_name ) );
                          ^

"../../boost/test/impl/debug.ipp", line 492: error: the global scope has no
          "snprintf"
      ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name );
        ^

"../../boost/test/impl/debug.ipp", line 516: error: the global scope has no
          "snprintf"
      ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s", 
        ^

"../../boost/test/impl/debug.ipp", line 530: error: the global scope has no
          "snprintf"
      ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
        ^

"../../boost/test/impl/debug.ipp", line 545: error: the global scope has no
          "snprintf"
      ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
        ^

"../../boost/test/impl/debug.ipp", line 582: error: the global scope has no
          "snprintf"
      ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
        ^

"../../boost/test/impl/debug.ipp", line 714: error: the global scope has no
          "kill"
      ::kill( ::getpid(), SIGTRAP );
        ^

"../../boost/test/impl/debug.ipp", line 863: error: the global scope has no
          "mkstemp"
      fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) );
                                     ^

10 errors detected in the compilation of "../../libs/test/src/debug.cpp".

    como -tused -c --long_long  -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 --no_inlining -O0 -g --exceptions -I"../.."   -o "../../bin.v2/libs/test/build/como-linux/debug/debug.o" "../../libs/test/src/debug.cpp" 2>&1

...failed como-linux.compile.c++ ../../bin.v2/libs/test/build/como-linux/debug/debug.o...

I installed Comeau compiler with relaxed mode of compilation configured as default. The snprintf function comes from C99 and as far as I'm experienced with Comeau C/C++, in relaxed mode it is not available unless Comeau's option --c99 is specified

Environment: Ubuntu 9.04 (32-bit), GCC 4.3.3, Comeau C/C++ 4.3.10.1

Attachments (1)

como-snprintf-svnprintf-ticket-3558.patch (2.5 KB ) - added by mloskot <mateusz@…> 13 years ago.
Patch adding snprintf and vsnprintf workaround based on sprintf/vsprintf for Comeau C++ compiler

Download all attachments as: .zip

Change History (5)

comment:1 by Gennadiy Rozental, 13 years ago

Resolution: wontfix
Status: newclosed

Looks like it can't fine mkstemp as well. How about execution_monitor? it uses vsnprintf as well? We do want to use snprintf. I do not have access to this compiler. Please provide patch and I can incorporate it.

comment:2 by mloskot <mateusz@…>, 13 years ago

As I explained on the mailing list, the issue is that I found it not possible to enable both C99 and C++ modes for Comeau compiler.

Regarding mkstemp and others, these are POSIX functions and it's easy to enable them by adding extra preprocessor definition -D_SVID_SOURCE

I'll try to sort it out and to submit patch. In the meantime, would it be possible to enable _SVID_SOURCE for the como toolset in Jamfiles?

by mloskot <mateusz@…>, 13 years ago

Patch adding snprintf and vsnprintf workaround based on sprintf/vsprintf for Comeau C++ compiler

comment:3 by mloskot <mateusz@…>, 13 years ago

Regarding my comment about POSIX support for Comeau compiler, here is separate ticket #3662 with patch that shows what definitions are missing.

comment:4 by mloskot <mateusz@…>, 13 years ago

Related ticket, but not duplicate, is #3662

Note: See TracTickets for help on using tickets.