]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/endian/test/endian_test.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / endian / test / endian_test.cpp
index 3ccaef0545257d4ee2402764cc44316397b38521..6aa86524efc80afd3da17156ef399f0c7f9ac9bf 100644 (file)
@@ -20,7 +20,6 @@
 
 #include <boost/endian/arithmetic.hpp>
 #include <boost/cstdint.hpp>
-#include <boost/detail/lightweight_main.hpp>
 
 #include <iostream>
 #include <limits>
 #include <cstdlib>    // for atoi(), exit()
 #include <cstring>    // for memcmp()
 
+#if defined(_MSC_VER)
+# pragma warning(disable: 4127)  // conditional expression is constant
+#endif
+
 using namespace std;             // Not the best programming practice, but I
 using namespace boost;           //   want to verify this combination of using
 using namespace boost::endian;   //   namespaces works. See endian_operations_test
@@ -102,11 +105,7 @@ namespace
   template <class Endian>
   inline void verify_native_representation( int line )
   {
-#   if BOOST_ENDIAN_BIG_BYTE
-      verify_representation<Endian>( true, line );
-#   else
-      verify_representation<Endian>( false, line );
-#   endif
+    verify_representation<Endian>( order::native == order::big, line );
   }
 
   //  detect_order  -----------------------------------------------------//
@@ -124,22 +123,24 @@ namespace
     if ( memcmp( v.c, "\x8\7\6\5\4\3\2\1", 8) == 0 )
     {
       cout << "This machine is little-endian.\n";
-  #   if !BOOST_ENDIAN_LITTLE_BYTE
-        cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_LITTLE_BYTE.\n"
+      if( order::native != order::little )
+      {
+        cout << "yet boost::endian::order::native does not equal boost::endian::order::little.\n"
           "The Boost Endian library must be revised to work correctly on this system.\n"
           "Please report this problem to the Boost mailing list.\n";
         exit(1);
-  #   endif
+      }
     }
     else if ( memcmp( v.c, "\1\2\3\4\5\6\7\x8", 8) == 0 )
     {
       cout << "This machine is big-endian.\n";
-  #   if !BOOST_ENDIAN_BIG_BYTE
-        cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_BIG_BYTE.\n"
+      if( order::native != order::big )
+      {
+        cout << "yet boost::endian::order::native does not equal boost::endian::order::big.\n"
           "The Boost Endian library must be revised to work correctly on this system.\n"
           "Please report this problem to the Boost mailing list.\n";
         exit(1);
-  #   endif
+      }
     }
     else
     {
@@ -836,3 +837,16 @@ int cpp_main( int argc, char * argv[] )
 
   return err_count ? 1 : 0;
 } // main
+
+int main( int argc, char* argv[] )
+{
+    try
+    {
+        return cpp_main( argc, argv );
+    }
+    catch( std::exception const & x )
+    {
+        std::cout << "Exception: " << x.what() << std::endl;
+        return 1;
+    }
+}