Ticket #3558: como-snprintf-svnprintf-ticket-3558.patch

File 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

  • boost/config/platform/linux.hpp

     
    4040#    define BOOST_NO_SWPRINTF
    4141#  endif
    4242
     43   // Comeau C++ (como) on linux does not have C99 functions
     44   // (used in test, program_options)
     45#  define BOOST_NO_SNPRINTF
     46#  define BOOST_NO_VSNPRINTF
     47
    4348#endif
    4449
    4550//
  • boost/test/impl/execution_monitor.ipp

     
    198198#include <errno.h>
    199199#endif
    200200
     201#if defined(BOOST_NO_VSNPRINTF)
     202using ::boost::unit_test::ut_detail::vsnprintf;
     203#endif
     204
    201205#include <boost/test/detail/suppress_warnings.hpp>
    202206
    203207//____________________________________________________________________________//
  • boost/test/impl/debug.ipp

     
    108108
    109109#endif
    110110
     111#if defined(BOOST_NO_SNPRINTF)
     112using ::boost::unit_test::ut_detail::snprintf;
     113#endif
     114
    111115#include <boost/test/detail/suppress_warnings.hpp>
    112116
    113117//____________________________________________________________________________//
  • boost/test/detail/workaround.hpp

     
    2020
    2121// STL
    2222#include <iterator>     // for std::distance
    23 
     23#include <cstdio>       // for sprintf, vsprintf
    2424#include <boost/test/detail/suppress_warnings.hpp>
    2525
    2626//____________________________________________________________________________//
     
    4848using std::distance;
    4949#endif
    5050
     51// snprintf, vsnprintf workaround for Comeau C/C++ toolset
     52#if defined(__COMO__)
     53
     54#  if defined(BOOST_NO_SNPRINTF)
     55int snprintf(char *s, size_t /*maxlen*/, const char *format, ...)
     56{
     57    va_list arg;
     58    int retval;
     59    va_start(arg, format);
     60    retval = std::vsprintf(s, format, arg);
     61    va_end(arg);
     62    return retval;
     63}
     64#  endif
     65
     66#  if defined(BOOST_NO_VSNPRINTF)
     67int vsnprintf(char *s, size_t maxlen, const char *format, va_list arg)
     68{
     69    return std::vsprintf(s, format, arg);
     70}
     71#  endif
     72
     73#endif
     74
     75
    5176template <class T> inline void ignore_unused_variable_warning(const T&) {}
    5277
    5378} // namespace ut_detail