This change fixes an incorrect assumption in s-oscons-tmplt.c that
CLOCK_REALTIME is always a C preprocessor macro. On HP-UX, it is actually
an enumeration literal. The incorrect assumption caused a build failure
that platform.

NOT tested on pa hp-ux directly, so change done blindly.
Dave, can you please confirm whether the PR is fixed or not?

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-05  Thomas Quinot  <qui...@adacore.com>

        PR ada/51307
        * s-oscons-tmplt.c: On HP-UX, CLOCK_REALTIME is an enum literal,
        not a macro.

Index: s-oscons-tmplt.c
===================================================================
--- s-oscons-tmplt.c    (revision 182003)
+++ s-oscons-tmplt.c    (working copy)
@@ -1343,7 +1343,13 @@
 
 */
 
-#ifdef CLOCK_REALTIME
+/* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
+
+#if defined(CLOCK_REALTIME) || defined (__hpux__)
+# define HAVE_CLOCK_REALTIME
+#endif
+
+#ifdef HAVE_CLOCK_REALTIME
 CND(CLOCK_REALTIME, "System realtime clock")
 #endif
 
@@ -1377,7 +1383,7 @@
 # define CLOCK_RT_Ada "CLOCK_MONOTONIC"
 # define NEED_PTHREAD_CONDATTR_SETCLOCK
 
-#elif defined(CLOCK_REALTIME)
+#elif defined(HAVE_CLOCK_REALTIME)
 /* By default use CLOCK_REALTIME */
 # define CLOCK_RT_Ada "CLOCK_REALTIME"
 #endif

Reply via email to