Opened 9 years ago

Closed 7 years ago

Last modified 5 years ago

#9379 closed Bugs (wontfix)

'boost::chrono::steady_clock' has not been declared" on boost 1.55, hp-ux 11.23 IA, gcc 4.6

Reported by: gengyonghui@… Owned by: viboes
Milestone: To Be Determined Component: chrono
Version: Boost 1.58.0 Severity: Problem
Keywords: steady_clock Cc:

Description (last modified by viboes)

../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp: In member function 'bool boost::recursive_timed_mutex::try_lock_for(const boost::chrono::duration<Rep, Period>&)':
../lib/include/boost/boost/thread/pthread/recursive_mutex.hpp:357:41: error: 'boost::chrono::steady_clock' has not been declared
In file included from ../lib/include/boost/boost/thread.hpp:24:0,
                 from ../src/
                 ...

../lib/include/boost/boost/thread/future.hpp: In member function 'boost::future_status boost::detail::basic_future<R>::wait_for(const boost::chrono::duration<Rep2, Period2>&) const':
../lib/include/boost/boost/thread/future.hpp:1395:37: error: 'boost::

Attachments (3)

user_time.h (16.4 KB ) - added by gengyonghui@… 9 years ago.
user_sys_time.h (24.1 KB ) - added by gengyonghui@… 9 years ago.
ticket9379.patch (2.2 KB ) - added by brian.groose@… 5 years ago.
Patch for tocket 9379

Download all attachments as: .zip

Change History (33)

comment:1 by anonymous, 9 years ago

./lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'boost::cv_status boost::condition_variable_any::wait_for(lock_type&, const boost::chrono::duration<Rep2, Period>&)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:11: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:295:36: error: expected ';' before 'c_now' ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:18: error: 'steady_clock' has not been declared ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:297:40: error: 'c_now' was not declared in this scope ../lib/include/boost/boost/thread/pthread/condition_variable.hpp: In member function 'bool boost::condition_variable_any::wait_for(lock_type&, const boost::chrono::duration<Rep, Period>&, Predicate)': ../lib/include/boost/boost/thread/pthread/condition_variable.hpp:310:43: error: 'boost::chrono::steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/thread_only.hpp:26:0,

from ../lib/include/boost/boost/thread/thread.hpp:12, from ../lib/include/boost/boost/thread.hpp:13, from ../src/...

../lib/include/boost/boost/thread/v2/thread.hpp: At global scope: ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:47: error: 'steady_clock' is not a member of 'boost::chrono' ../lib/include/boost/boost/thread/v2/thread.hpp:59:77: error: template argument 1 is invalid ../lib/include/boost/boost/thread/v2/thread.hpp: In function 'void boost::this_thread::sleep_until(const int&)': ../lib/include/boost/boost/thread/v2/thread.hpp:62:21: error: 'steady_clock' has not been declared In file included from ../lib/include/boost/boost/thread/shared_mutex.hpp:22:0,

from ../lib/include/boost/boost/thread/detail/thread_group.hpp:9, from ../lib/include/boost/boost/thread/thread.hpp:13, from ../lib/include/boost/boost/thread.hpp:13, from ../src/...

comment:2 by anonymous, 9 years ago

Hi experts, The problem can be reproduced easily,

uname -a
HP-UX B.11.23 U ia64

$gcc -v
gcc version 4.6.3 (GCC)

$cat thread.cpp

<

#include <string>
#include <iostream>
#include <boost/thread.hpp>
using namespace std;


class BankAccount;

BankAccount JoesAccount;

void bankAgent()
{
    for (int i =10; i>0; --i) {
        //...
        JoesAccount.Deposit(500);
        //...
    }
}

void Joe() {
    for (int i =10; i>0; --i) {
        //...
        int myPocket = JoesAccount.Withdraw(100);
        std::cout << myPocket << std::endl;
        //...
    }
}

int main() {
    //...
    boost::thread thread1(bankAgent); // start concurrent execution of bankAgent
    boost::thread thread2(Joe); // start concurrent execution of Joe
    thread1.join();
    thread2.join();
    return 0;
}

Error:
<
irvspxue:builder> g++ -Iboost_1_55_0 -o thread thread.cpp
In file included from boost_1_55_0/boost/thread/mutex.hpp:16:0,
                 from boost_1_55_0/boost/thread/pthread/thread_data.hpp:13,
                 from boost_1_55_0/boost/thread/thread_only.hpp:17,
                 from boost_1_55_0/boost/thread/thread.hpp:12,
                 from boost_1_55_0/boost/thread.hpp:13,
                 from thread.cpp:5:
boost_1_55_0/boost/thread/pthread/mutex.hpp: In member function 'bool boost::timed_mutex::try_lock_for(const boost::chrono::duration<Rep, Period>&)':
boost_1_55_0/boost/thread/pthread/mutex.hpp:309:41: error: 'boost::chrono::steady_clock' has not been declared
In file included from boost_1_55_0/boost/thread/pthread/thread_data.hpp:14:0,
                 from boost_1_55_0/boost/thread/thread_only.hpp:17,
                 from boost_1_55_0/boost/thread/thread.hpp:12,
                 from boost_1_55_0/boost/thread.hpp:13,
                 from thread.cpp:5:
boost_1_55_0/boost/thread/pthread/condition_variable_fwd.hpp: In member function 'boost::cv_status boost::condition_variable::wait_for(boost::unique_lock<boost::mutex>&, const boost::chrono::duration<Rep, Period>&)':
>
Last edited 9 years ago by viboes (previous) (diff)

comment:3 by viboes, 9 years ago

Status: newassigned

comment:4 by viboes, 9 years ago

HI,

please could you check the boost/chrono/config.hpp file.

It contains the following

# if defined( BOOST_CHRONO_WINDOWS_API )
#   ifndef UNDER_CE
#     define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   endif
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_HAS_THREAD_CLOCK
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_MAC_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_POSIX_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
#   if defined(CLOCK_MONOTONIC)
#      define BOOST_CHRONO_HAS_CLOCK_STEADY
#   endif

Does your platform meets the condition for which BOOST_CHRONO_HAS_CLOCK_STEADY is defined?

comment:5 by gengyonghui@…, 9 years ago

I tested the micro, it is NOT defined under hp-ux ia 11.23, hp-ux pa 11.11, and solaris 8/9. But is defined under AIX 5.2.

$uname -a HP-UX machinename B.11.23 U ia64 unlimited-user license

$cat micro.cpp #include <string> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <boost/chrono/config.hpp> using namespace std;

int main() { #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY

printf("boost_chrono_has_clock_steady is defined!\n");

#else

printf("boost_chrono_has_clock_steady is not defined!\n");

#endif

return 0;

}

$g++ -Iboost_1_55_0 -o micro micro.cpp

$./micro boost_chrono_has_clock_steady is not defined!

Thanks.

comment:6 by viboes, 9 years ago

I was requesting you to analyze why it is not defined. It is because CLOCK_MONOTONIC is not defined? If yes, could you find if there is something like that?

by gengyonghui@…, 9 years ago

Attachment: user_time.h added

by gengyonghui@…, 9 years ago

Attachment: user_sys_time.h added

comment:7 by anonymous, 9 years ago

Hi Viboes, You are right, CLOCK_MONOTONIC is not defined. I have attached /usr/include/time.h and /usr/include/sys/time.h files. Thanks.

comment:8 by viboes, 9 years ago

Description: modified (diff)

comment:9 by viboes, 9 years ago

Resolution: worksforme
Status: assignedclosed

comment:10 by brian.groose@…, 8 years ago

Resolution: worksforme
Status: closedreopened

I have the same issue on HP/UX. CLOCK_MONOTONIC is not available on HP/UX. I suppose CLOCK_REALTIME would be a non-optimal fallback. However, there is a gethrtime() function that returns a similar value to clock_gettime(CLOCK_MONOTONIC), also measured in nanoseconds:

typedef int64_t hrtime_t;

hrtime_t gethrtime(void);

comment:11 by viboes, 8 years ago

Please, could you provide a patch, I'm unable to test it, so unable to write it.

comment:12 by 20313412@…, 8 years ago

Hi Viboes,I have the same issue too. Could you please provide a patch? Or any suggestion/workaround to resolve this issue? I'll follow your suggestion to write a patch and verify the patch in our environment as soon as possible .

comment:13 by 20313412@…, 8 years ago

My email address 20313412@…, anyone knows how to fix this issue please mail me.

comment:14 by viboes, 8 years ago

Ok. I will create a branch to take care of this issue. I will add code as soon as I know what to put in. I would need that you check this branch on your environment.

We can start by identifying under which conditions gethrtime is available. Try something like that and tell me what to put in WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED.

git diff
diff --git a/include/boost/chrono/config.hpp b/include/boost/chrono/config.hpp
index 1045ba3..7ae6d8f 100644
--- a/include/boost/chrono/config.hpp
+++ b/include/boost/chrono/config.hpp
@@ -84,6 +84,13 @@
 #   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
 #   if defined(CLOCK_MONOTONIC)
 #      define BOOST_CHRONO_HAS_CLOCK_STEADY
+#     if BOOST_PLATFORM="HP-UX"
+#       include <user_time.h>  //to check for gethrtime
+#       if defined(WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED)
+#         define BOOST_CHRONO_HAS_GETHRTIME
+#         define BOOST_CHRONO_HAS_CLOCK_STEADY
+#       endif
+#     endif
 #   endif

comment:15 by viboes, 8 years ago

Once you have found the flag, we can continue with

diff --git a/include/boost/chrono/detail/inlined/posix/chrono.hpp b/include/boost/chrono/detail/inlined/posix/chrono.hpp
index e35a7ce..5a0d42d 100644
--- a/include/boost/chrono/detail/inlined/posix/chrono.hpp
+++ b/include/boost/chrono/detail/inlined/posix/chrono.hpp
@@ -73,6 +73,9 @@ namespace chrono
 
   steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
   {
+#ifdef BOOST_CHRONO_HAS_GETHRTIME
+    return time_point(nanoseconds(gethrtime());
+#else
     timespec ts;
     if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
     {
@@ -81,20 +84,25 @@ namespace chrono
 
     return time_point(duration(
       static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+#endif
   }
 
 #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
   steady_clock::time_point steady_clock::now(system::error_code & ec)
   {
+#ifdef BOOST_CHRONO_HAS_GETHRTIME
+    ec.clear();
+    return time_point(nanoseconds(gethrtime());
+#else
     timespec ts;
     if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
     {
         if (BOOST_CHRONO_IS_THROWS(ec))
         {
             boost::throw_exception(
-                    system::system_error( 
-                            errno, 
-                            BOOST_CHRONO_SYSTEM_CATEGORY, 
+                    system::system_error(
+                            errno,
+                            BOOST_CHRONO_SYSTEM_CATEGORY,
                             "chrono::steady_clock" ));
         }
         else
@@ -104,12 +112,13 @@ namespace chrono
         }
     }
 
-    if (!BOOST_CHRONO_IS_THROWS(ec)) 
+    if (!BOOST_CHRONO_IS_THROWS(ec))
     {
         ec.clear();
     }
     return time_point(duration(
       static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
+#endif
   }
 #endif
 #endif

comment:17 by viboes, 8 years ago

Maybe this will help you to find out the flag

This API will only be available if the application is being compiled in -Ae mode 
(extended ANSI) because 64-bit integer numbers are not available in -Aa (ANSI) mode. 
Please refer to cc(1).

comment:18 by viboes, 8 years ago

Yet an additional commit

Added the possibility for the user to define BOOST_CHRONO_HAS_GETHRTIME and manage with error cases

https://github.com/boostorg/chrono/commit/b06da09faaa0ee55e991695e81b7320bdaf4e6e6

Please, define BOOST_CHRONO_HAS_GETHRTIME on your build system to see if the patch works.

If this is the case, the last thing to find are the flag for WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED.

comment:19 by 20313412@…, 8 years ago

Hi Viboes, what a quick response!

My test environment: HP-UX B.11.23 ia64, gcc 4.7.1, boost 1.53 and boost 1.57

my findings:

  1. there's no header file named user_time.h on hp-ux
  2. I didn't find any flag(in time.h) which controls the availability of function gethrtime, just use this function directly and everything works fine( or please kindly tell me how to find the Flag that you want);
  3. with some modification based on your patch, the bug is verified to be fixed!!!!
  4. please kindly let me know if you want any operation/verification under HP-UX, I'd like to do that.
--------------------config.hpp------------------------------
#ifndef BOOST_CHRONO_CONFIG_HPP
#define BOOST_CHRONO_CONFIG_HPP

#include <boost/config.hpp>

#if !defined BOOST_CHRONO_VERSION
#define BOOST_CHRONO_VERSION 1
#else
#if BOOST_CHRONO_VERSION!=1  && BOOST_CHRONO_VERSION!=2
#error "BOOST_CHRONO_VERSION must be 1 or 2"
#endif
#endif

#if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H)
#define BOOST_USE_WINDOWS_H
#endif

#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \
    && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT

# define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT

#endif

//  BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
//  can be defined by the user to specify which API should be used

#if defined(BOOST_CHRONO_WINDOWS_API)
# warning Boost.Chrono will use the Windows API
#elif defined(BOOST_CHRONO_MAC_API)
# warning Boost.Chrono will use the Mac API
#elif defined(BOOST_CHRONO_POSIX_API)
# warning Boost.Chrono will use the POSIX API
#endif

# if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API )
#   error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined
# elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API )
#   error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined
# elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API )
#   error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined
# elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
#   if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
#     define BOOST_CHRONO_WINDOWS_API
#   elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#     define BOOST_CHRONO_MAC_API
#   else
#     define BOOST_CHRONO_POSIX_API
#   endif
# endif

# if defined( BOOST_CHRONO_WINDOWS_API )
#   ifndef UNDER_CE
#     define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   endif
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_HAS_THREAD_CLOCK
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_MAC_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_POSIX_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
#   if defined(CLOCK_MONOTONIC) 
#      define BOOST_CHRONO_HAS_CLOCK_STEADY
#   elif (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)
#       if ! defined BOOST_CHRONO_HAS_GETHRTIME
#         define BOOST_CHRONO_HAS_GETHRTIME
#         define BOOST_CHRONO_HAS_CLOCK_STEADY
#       endif
#   endif

#   if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
#     define BOOST_CHRONO_HAS_THREAD_CLOCK
#     define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
#   endif
#   if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS)
#     define BOOST_CHRONO_HAS_THREAD_CLOCK
#     define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
#   endif
#   if defined(sun) || defined(__sun)
#     undef BOOST_CHRONO_HAS_THREAD_CLOCK
#     undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#   endif
#   if (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)
#     undef BOOST_CHRONO_HAS_THREAD_CLOCK
#     undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#   endif
#   if defined(__VXWORKS__)
#     undef BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   endif
# endif

#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
#undef BOOST_CHRONO_HAS_THREAD_CLOCK
#undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#endif

//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS

// unicode support  ------------------------------//

#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T)
//~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT
#else
#define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1
#endif

#if ! defined BOOST_NOEXCEPT
#if defined(BOOST_NO_CXX11_NOEXCEPT)
#define BOOST_NOEXCEPT
#else
#define BOOST_NOEXCEPT noexcept
#endif
#endif

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#define BOOST_CHRONO_LIB_CONSTEXPR
#else
#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
#endif

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else
#ifdef BOOST_NO_CXX11_NOEXCEPT
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept
#endif
#endif


#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
 && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined"
#endif

#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
 && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined"
#endif

#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
 && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING
#endif

#if (BOOST_CHRONO_VERSION == 2)
#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
 && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#endif
#endif

#ifdef BOOST_CHRONO_HEADER_ONLY
#define BOOST_CHRONO_INLINE inline
#define BOOST_CHRONO_STATIC inline
#define BOOST_CHRONO_DECL

#else
#define BOOST_CHRONO_INLINE
#define BOOST_CHRONO_STATIC static

//  enable dynamic linking on Windows  ---------------------------------------//

// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
// export if this is our own source, otherwise import:
#ifdef BOOST_CHRONO_SOURCE
# define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT
#else
# define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT
#endif  // BOOST_CHRONO_SOURCE
#endif  // DYN_LINK
//
// if BOOST_CHRONO_DECL isn't defined yet define it now:
#ifndef BOOST_CHRONO_DECL
#define BOOST_CHRONO_DECL
#endif



//  enable automatic library variant selection  ------------------------------//

#if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)
//
// Set the name of our library; this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_chrono
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
#  define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif  // auto-linking disabled
#endif // BOOST_CHRONO_HEADER_ONLY
#endif // BOOST_CHRONO_CONFIG_HPP

#include <time.h>  // for clock_gettime

namespace boost
{
namespace chrono
{

  system_clock::time_point system_clock::now() BOOST_NOEXCEPT
  {
    timespec ts;
    if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
    {
      BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
    }

    return time_point(duration(
      static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
  }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  system_clock::time_point system_clock::now(system::error_code & ec)
  {
    timespec ts;
    if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
    {
        if (BOOST_CHRONO_IS_THROWS(ec))
        {
            boost::throw_exception(
                    system::system_error( 
                            errno, 
                            BOOST_CHRONO_SYSTEM_CATEGORY, 
                            "chrono::system_clock" ));
        }
        else
        {
            ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
            return time_point();
        }
    }

    if (!BOOST_CHRONO_IS_THROWS(ec)) 
    {
        ec.clear();
    }
    return time_point(duration(
      static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
  }
#endif

  std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT
  {
      return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 );
  }

  system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT
  {
      return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000));
  }

#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY

  steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
  {
#ifdef BOOST_CHRONO_HAS_GETHRTIME
    hrtime_t hrt = gethrtime();
    BOOST_ASSERT(hrt>=0);
    return time_point(nanoseconds(hrt));
#else
    timespec ts;
    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    {
      BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
    }

    return time_point(duration(
      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
#endif
  }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  steady_clock::time_point steady_clock::now(system::error_code & ec)
  {
#ifdef BOOST_CHRONO_HAS_GETHRTIME
    hrtime_t hrt = gethrtime();
    if (hrt<0)
    {
        boost::throw_exception(
                system::system_error(
                        EFAULT,
                        BOOST_CHRONO_SYSTEM_CATEGORY,
                        "chrono::steady_clock" ));
    }
    else
    {
        ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY );
        return time_point();
    }
    if (!BOOST_CHRONO_IS_THROWS(ec))
    {
        ec.clear();
    }
    return time_point(nanoseconds(hrt));
#else
    timespec ts;
    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    {
        if (BOOST_CHRONO_IS_THROWS(ec))
        {
            boost::throw_exception(
                    system::system_error( 
                            errno, 
                            BOOST_CHRONO_SYSTEM_CATEGORY, 
                            "chrono::steady_clock" ));
        }
        else
        {
            ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
            return time_point();
        }
    }

    if (!BOOST_CHRONO_IS_THROWS(ec)) 
    {
        ec.clear();
    }
    return time_point(duration(
      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
#endif
  }
#endif
#endif

}  // namespace chrono
}  // namespace boost


Last edited 8 years ago by viboes (previous) (diff)

comment:20 by 20313412@…, 8 years ago

following code for config.hpp works fine!

#ifndef BOOST_CHRONO_CONFIG_HPP
#define BOOST_CHRONO_CONFIG_HPP

#include <boost/config.hpp>

#if !defined BOOST_CHRONO_VERSION
#define BOOST_CHRONO_VERSION 1
#else
#if BOOST_CHRONO_VERSION!=1  && BOOST_CHRONO_VERSION!=2
#error "BOOST_CHRONO_VERSION must be 1 or 2"
#endif
#endif

#if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H)
#define BOOST_USE_WINDOWS_H
#endif

#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \
    && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT

# define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT

#endif

//  BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
//  can be defined by the user to specify which API should be used

#if defined(BOOST_CHRONO_WINDOWS_API)
# warning Boost.Chrono will use the Windows API
#elif defined(BOOST_CHRONO_MAC_API)
# warning Boost.Chrono will use the Mac API
#elif defined(BOOST_CHRONO_POSIX_API)
# warning Boost.Chrono will use the POSIX API
#endif

# if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API )
#   error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined
# elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API )
#   error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined
# elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API )
#   error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined
# elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
#   if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
#     define BOOST_CHRONO_WINDOWS_API
#   elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#     define BOOST_CHRONO_MAC_API
#   else
#     define BOOST_CHRONO_POSIX_API
#   endif
# endif

# if defined( BOOST_CHRONO_WINDOWS_API )
#   ifndef UNDER_CE
#     define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   endif
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_HAS_THREAD_CLOCK
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_MAC_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   define BOOST_CHRONO_HAS_CLOCK_STEADY
#   define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
# endif

# if defined( BOOST_CHRONO_POSIX_API )
#   define BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
#   if defined(CLOCK_MONOTONIC) 
#      define BOOST_CHRONO_HAS_CLOCK_STEADY
#   elif (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)
#       if ! defined BOOST_CHRONO_HAS_GETHRTIME
#         define BOOST_CHRONO_HAS_GETHRTIME
#         define BOOST_CHRONO_HAS_CLOCK_STEADY
#       endif
#   endif

#   if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
#     define BOOST_CHRONO_HAS_THREAD_CLOCK
#     define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
#   endif
#   if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS)
#     define BOOST_CHRONO_HAS_THREAD_CLOCK
#     define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
#   endif
#   if defined(sun) || defined(__sun)
#     undef BOOST_CHRONO_HAS_THREAD_CLOCK
#     undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#   endif
#   if (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)
#     undef BOOST_CHRONO_HAS_THREAD_CLOCK
#     undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#   endif
#   if defined(__VXWORKS__)
#     undef BOOST_CHRONO_HAS_PROCESS_CLOCKS
#   endif
# endif

#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
#undef BOOST_CHRONO_HAS_THREAD_CLOCK
#undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
#endif

//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS

// unicode support  ------------------------------//

#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T)
//~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT
#else
#define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1
#endif

#if ! defined BOOST_NOEXCEPT
#if defined(BOOST_NO_CXX11_NOEXCEPT)
#define BOOST_NOEXCEPT
#else
#define BOOST_NOEXCEPT noexcept
#endif
#endif

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#define BOOST_CHRONO_LIB_CONSTEXPR
#else
#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
#endif

#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else
#ifdef BOOST_NO_CXX11_NOEXCEPT
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else
#  define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept
#endif
#endif


#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
 && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined"
#endif

#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
 && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined"
#endif

#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
 && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING
#endif

#if (BOOST_CHRONO_VERSION == 2)
#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
 && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
#endif
#endif

#ifdef BOOST_CHRONO_HEADER_ONLY
#define BOOST_CHRONO_INLINE inline
#define BOOST_CHRONO_STATIC inline
#define BOOST_CHRONO_DECL

#else
#define BOOST_CHRONO_INLINE
#define BOOST_CHRONO_STATIC static

//  enable dynamic linking on Windows  ---------------------------------------//

// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
// export if this is our own source, otherwise import:
#ifdef BOOST_CHRONO_SOURCE
# define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT
#else
# define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT
#endif  // BOOST_CHRONO_SOURCE
#endif  // DYN_LINK
//
// if BOOST_CHRONO_DECL isn't defined yet define it now:
#ifndef BOOST_CHRONO_DECL
#define BOOST_CHRONO_DECL
#endif



//  enable automatic library variant selection  ------------------------------//

#if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)
//
// Set the name of our library; this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_chrono
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
#  define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif  // auto-linking disabled
#endif // BOOST_CHRONO_HEADER_ONLY
#endif // BOOST_CHRONO_CONFIG_HPP


comment:21 by 20313412@…, 8 years ago

following code for chrono.hpp works fine!


#include <time.h>  // for clock_gettime

namespace boost
{
namespace chrono
{

  system_clock::time_point system_clock::now() BOOST_NOEXCEPT
  {
    timespec ts;
    if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
    {
      BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
    }

    return time_point(duration(
      static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
  }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  system_clock::time_point system_clock::now(system::error_code & ec)
  {
    timespec ts;
    if ( ::clock_gettime( CLOCK_REALTIME, &ts ) )
    {
        if (BOOST_CHRONO_IS_THROWS(ec))
        {
            boost::throw_exception(
                    system::system_error( 
                            errno, 
                            BOOST_CHRONO_SYSTEM_CATEGORY, 
                            "chrono::system_clock" ));
        }
        else
        {
            ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
            return time_point();
        }
    }

    if (!BOOST_CHRONO_IS_THROWS(ec)) 
    {
        ec.clear();
    }
    return time_point(duration(
      static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
  }
#endif

  std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT
  {
      return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 );
  }

  system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT
  {
      return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000));
  }

#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY

  steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT
  {
#ifdef BOOST_CHRONO_HAS_GETHRTIME
    hrtime_t hrt = gethrtime();
    BOOST_ASSERT(hrt>=0);
    return time_point(nanoseconds(hrt));
#else
    timespec ts;
    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    {
      BOOST_ASSERT(0 && "Boost::Chrono - Internal Error");
    }

    return time_point(duration(
      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
#endif
  }

#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  steady_clock::time_point steady_clock::now(system::error_code & ec)
  {
#ifdef BOOST_CHRONO_HAS_GETHRTIME
    hrtime_t hrt = gethrtime();
    if (hrt<0)
    {
        boost::throw_exception(
                system::system_error(
                        EFAULT,
                        BOOST_CHRONO_SYSTEM_CATEGORY,
                        "chrono::steady_clock" ));
    }
    else
    {
        ec.assign( EFAULT, BOOST_CHRONO_SYSTEM_CATEGORY );
        return time_point();
    }
    if (!BOOST_CHRONO_IS_THROWS(ec))
    {
        ec.clear();
    }
    return time_point(nanoseconds(hrt));
#else
    timespec ts;
    if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
    {
        if (BOOST_CHRONO_IS_THROWS(ec))
        {
            boost::throw_exception(
                    system::system_error( 
                            errno, 
                            BOOST_CHRONO_SYSTEM_CATEGORY, 
                            "chrono::steady_clock" ));
        }
        else
        {
            ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY );
            return time_point();
        }
    }

    if (!BOOST_CHRONO_IS_THROWS(ec)) 
    {
        ec.clear();
    }
    return time_point(duration(
      static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
#endif
  }
#endif
#endif

}  // namespace chrono
}  // namespace boost




comment:22 by viboes, 8 years ago

Please, add only the changes, not the whole file. Post here the changes you want respect to what I is already in the last version of the fix branch.

I wan not say that we have always gethrtime() as the documentation says

This API will only be available if the application is being compiled in -Ae mode 
(extended ANSI) because 64-bit integer numbers are not available in -Aa (ANSI) mode. 
Please refer to cc(1).

I would need a flag that states if the user compiles with option -Ae.

The following

#   elif (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)

is equivalent to my

# if BOOST_PLATFORM="HP-UX"

Isn't it?

comment:23 by 20313412@…, 8 years ago

Sorry, here's the diff result:

diff -Nau org/chrono.hpp new/chrono.hpp
--- org/chrono.hpp      2015-01-25 23:38:43.724793129 +0800
+++ new/chrono.hpp      2015-01-25 23:38:54.084793418 +0800
@@ -76,7 +76,7 @@
 #ifdef BOOST_CHRONO_HAS_GETHRTIME
     hrtime_t hrt = gethrtime();
     BOOST_ASSERT(hrt>=0);
-    return time_point(nanoseconds(hrt);
+    return time_point(nanoseconds(hrt));
 #else
     timespec ts;
     if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
@@ -111,7 +111,7 @@
     {
         ec.clear();
     }
-    return time_point(nanoseconds(hrt);
+    return time_point(nanoseconds(hrt));
 #else
     timespec ts;
     if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) )
diff -Nau org/config.hpp new/config.hpp
--- org/config.hpp      2015-01-25 23:38:37.617794648 +0800
+++ new/config.hpp      2015-01-25 23:39:00.701793133 +0800
@@ -84,18 +84,13 @@
 #   include <time.h>  //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
 #   if defined(CLOCK_MONOTONIC)
 #      define BOOST_CHRONO_HAS_CLOCK_STEADY
-#     if BOOST_PLATFORM="HP-UX"
-#       include <user_time.h>  //to check for gethrtime
+#   elif (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux)
 #       if ! defined BOOST_CHRONO_HAS_GETHRTIME
-#         if defined(WHATEVER_HPUX_SPECIFIC_FLAG_ENSURES_GETHRTIME_WILL_BE_DEFINED)
-#           define BOOST_CHRONO_HAS_GETHRTIME
-#           define BOOST_CHRONO_HAS_CLOCK_STEADY
-#         endif
-#       else
+#         define BOOST_CHRONO_HAS_GETHRTIME
 #         define BOOST_CHRONO_HAS_CLOCK_STEADY
 #       endif
-#     endif
 #   endif
+
 #   if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
 #     define BOOST_CHRONO_HAS_THREAD_CLOCK
 #     define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true

Tomorrow, I'll try to find out the flag corresponding to -Aa and post the result here. I'll also test if # if BOOST_PLATFORM="HP-UX" works please hold on

comment:24 by viboes, 8 years ago

Thanks for the diff and the test. Fixed the missing right-parenthesis ). Removed include user_time.h.

https://github.com/boostorg/chrono/commit/7f817fe8c1a4b0e336e627fa658323e27facc39a

Yet missing the flag. I could merge this to develop as it works. The single thing the user must do is to define BOOST_CHRONO_HAS_GETHRTIME. This can be documented.

What do you think?

comment:26 by 20313412@…, 8 years ago

Hi Viboes, checked HP-UX with following code:

#include </usr/include/time.h>
int main()
{
    
  #ifdef _POSIX_SOURCE
    long long a = 0;
    a += 1;
    
    hrtime_t begin ;
    begin = gethrtime(); 
  #endif
  return 0;    
    
} 

both following cmd line successed

cc -g -Ae -o b b.c

cc -g -Aa -o b b.c

with following code

#include </usr/include/time.h>
int main()
{
    long long a = 0;
    a += 1;
    
    hrtime_t begin ;
    begin = gethrtime(); 
  return 0;    
    
} 

failed to compile with cc -g -Aa -o b b.c err msg:

"b.c", line 4: warning #2450-D: the type "long long" is nonstandard
      long long a = 0;
           ^
"b.c", line 7: error #2268: declaration may not appear after executable
          statement in block
      hrtime_t begin ;
      ^
"b.c", line 7: error #2020: identifier "hrtime_t" is undefined
      hrtime_t begin ;
      ^
2 errors detected in the compilation of "b.c".

but successed with cc -g -Ae -o b b.c

so , I think:

  1. BOOST_NO_LONG_LONG indicates no -Ae option used in cmd line
  2. _POSIX_SOURCE indicates -Ae model too
  3. since {{{In HP-UX 10.20 and earlier releases, compatibility mode is the default

compilation mode. In HP-UX 10.30 forward, extended ANSI mode (-Ae) is the default}}}, maybe it's not necessary to check -Ae model?

comment:27 by viboes, 8 years ago

I think about just checking the version, however the default is not forcedly what the user uses ;-)

comment:28 by viboes, 7 years ago

Resolution: wontfix
Status: reopenedclosed

comment:29 by anonymous, 6 years ago

Version: Boost 1.55.0Boost 1.58.0

by brian.groose@…, 5 years ago

Attachment: ticket9379.patch added

Patch for tocket 9379

comment:30 by brian.groose@…, 5 years ago

I know this has been resolved as wontfix, but if there's any chance of this getting fixed, that would be great. I have attached a patch that fixes this for g++ on HPUX, based on previous patches attached and references in this bug. I did not test with aCC since I do not use it.

Note: See TracTickets for help on using tickets.