Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / test / impl / execution_monitor.ipp
index ccc4497..caf077c 100644 (file)
@@ -242,6 +242,9 @@ extract( boost::exception const* ex )
 //____________________________________________________________________________//
 
 static void
+#if __GNUC__ >= 3
+__attribute__((__format__ (__printf__, 3, 0)))
+#endif
 report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args )
 {
     static const int REPORT_ERROR_BUFFER_SIZE = 4096;
@@ -260,6 +263,9 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
 //____________________________________________________________________________//
 
 static void
+#if __GNUC__ >= 3
+__attribute__((__format__ (__printf__, 3, 4)))
+#endif
 report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... )
 {
     va_list args;
@@ -273,6 +279,9 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
 //____________________________________________________________________________//
 
 static void
+#if __GNUC__ >= 3
+__attribute__((__format__ (__printf__, 2, 3)))
+#endif
 report_error( execution_exception::error_code ec, char const* format, ... )
 {
     va_list args;
@@ -391,14 +400,19 @@ system_signal_exception::report() const
         report_error( execution_exception::system_error,
                       "signal: the expiration of a timer set by timer_settimer()" );
         break;
+// OpenBSD was missing SI_ASYNCIO and SI_MESGQ
+#ifdef SI_ASYNCIO
     case SI_ASYNCIO:
         report_error( execution_exception::system_error,
                       "signal: generated by the completion of an asynchronous I/O request" );
         break;
+#endif
+#ifdef SI_MESGQ
     case SI_MESGQ:
         report_error( execution_exception::system_error,
                       "signal: generated by the the arrival of a message on an empty message queue" );
         break;
+#endif
     default:
         break;
     }
@@ -410,48 +424,48 @@ system_signal_exception::report() const
         case ILL_ILLOPC:
             report_error( execution_exception::system_fatal_error,
                           "signal: illegal opcode; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_ILLTRP:
             report_error( execution_exception::system_fatal_error,
                           "signal: illegal trap; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_PRVREG:
             report_error( execution_exception::system_fatal_error,
                           "signal: privileged register; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_BADSTK:
             report_error( execution_exception::system_fatal_error,
                           "signal: internal stack error; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
 #endif
         case ILL_ILLOPN:
             report_error( execution_exception::system_fatal_error,
                           "signal: illegal operand; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_ILLADR:
             report_error( execution_exception::system_fatal_error,
                           "signal: illegal addressing mode; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_PRVOPC:
             report_error( execution_exception::system_fatal_error,
                           "signal: privileged opcode; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case ILL_COPROC:
             report_error( execution_exception::system_fatal_error,
                           "signal: co-processor error; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         default:
             report_error( execution_exception::system_fatal_error,
                           "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)",
-                          m_sig_info->si_addr, m_sig_info->si_code );
+                          m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
             break;
         }
         break;
@@ -461,47 +475,47 @@ system_signal_exception::report() const
         case FPE_INTDIV:
             report_error( execution_exception::system_error,
                           "signal: integer divide by zero; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_INTOVF:
             report_error( execution_exception::system_error,
                           "signal: integer overflow; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTDIV:
             report_error( execution_exception::system_error,
                           "signal: floating point divide by zero; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTOVF:
             report_error( execution_exception::system_error,
                           "signal: floating point overflow; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTUND:
             report_error( execution_exception::system_error,
                           "signal: floating point underflow; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTRES:
             report_error( execution_exception::system_error,
                           "signal: floating point inexact result; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTINV:
             report_error( execution_exception::system_error,
                           "signal: invalid floating point operation; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case FPE_FLTSUB:
             report_error( execution_exception::system_error,
                           "signal: subscript out of range; address of failing instruction: 0x%08lx",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         default:
             report_error( execution_exception::system_error,
                           "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)",
-                          m_sig_info->si_addr, m_sig_info->si_code );
+                          m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
             break;
         }
         break;
@@ -512,18 +526,18 @@ system_signal_exception::report() const
         case SEGV_MAPERR:
             report_error( execution_exception::system_fatal_error,
                           "memory access violation at address: 0x%08lx: no mapping at fault address",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case SEGV_ACCERR:
             report_error( execution_exception::system_fatal_error,
                           "memory access violation at address: 0x%08lx: invalid permissions",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
 #endif
         default:
             report_error( execution_exception::system_fatal_error,
                           "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
-                          m_sig_info->si_addr, m_sig_info->si_code );
+                          m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
             break;
         }
         break;
@@ -534,23 +548,23 @@ system_signal_exception::report() const
         case BUS_ADRALN:
             report_error( execution_exception::system_fatal_error,
                           "memory access violation at address: 0x%08lx: invalid address alignment",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case BUS_ADRERR:
             report_error( execution_exception::system_fatal_error,
                           "memory access violation at address: 0x%08lx: non-existent physical address",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
         case BUS_OBJERR:
             report_error( execution_exception::system_fatal_error,
                           "memory access violation at address: 0x%08lx: object specific hardware error",
-                          m_sig_info->si_addr );
+                          (uintptr_t) m_sig_info->si_addr );
             break;
 #endif
         default:
             report_error( execution_exception::system_fatal_error,
                           "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)",
-                          m_sig_info->si_addr, m_sig_info->si_code );
+                          m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr );
             break;
         }
         break;
@@ -596,7 +610,7 @@ system_signal_exception::report() const
         default:
             report_error( execution_exception::system_error,
                           "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)",
-                          (int)m_sig_info->si_band, m_sig_info->si_code );
+                          m_sig_info->si_code, (int)m_sig_info->si_band );
             break;
         }
         break;
@@ -1171,7 +1185,7 @@ execution_monitor::catch_signals( boost::function<int ()> const& F )
 
         if( htimer != INVALID_HANDLE_VALUE ) {
             LARGE_INTEGER liDueTime;
-            liDueTime.QuadPart = - static_cast<signed long int>(p_timeout) * 10; // resolution of 100 ns
+            liDueTime.QuadPart = - static_cast<LONGLONG>(p_timeout) * 10ll; // resolution of 100 ns
 
             bTimerSuccess = ::SetWaitableTimer(
                 htimer,
@@ -1295,11 +1309,7 @@ execution_monitor::execute( boost::function<int ()> const& F )
     catch( boost::exception const& ex )
       { detail::report_error( execution_exception::cpp_exception_error,
                               &ex,
-#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)
-                              "unknown boost::exception" ); }
-#else
-                              boost::diagnostic_information(ex).c_str() ); }
-#endif
+                              "%s", boost::diagnostic_information(ex).c_str() ); }
 
     //  std:: exceptions
 #if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI)