OSDN Git Service

Make clockapi symbolic constants #ifdef detectable.
authorKeith Marshall <keith@users.osdn.me>
Sun, 2 Sep 2018 19:28:38 +0000 (20:28 +0100)
committerKeith Marshall <keith@users.osdn.me>
Sun, 2 Sep 2018 19:28:38 +0000 (20:28 +0100)
mingwrt/ChangeLog
mingwrt/include/time.h
mingwrt/mingwex/clockapi.c

index 9edae87..24c9f0a 100644 (file)
@@ -1,3 +1,11 @@
+2018-09-02  Keith Marshall  <keith@users.osdn.me>
+
+       Make clockapi symbolic constants #ifdef detectable.
+
+       * mingwex/clockapi.c (CLOCK_REALTIME, CLOCK_MONOTONIC): Add "const".
+       * include/time.h (CLOCK_REALTIME, CLOCK_MONOTONIC): Likewise; also
+       define both as self-referencing macros.
+
 2018-08-26  Keith Marshall  <keith@users.osdn.me>
 
        Circumvent <process.h> testsuite failure with GCC-7+.
index d27add7..89f4b09 100644 (file)
@@ -6,7 +6,7 @@
  * $Id$
  *
  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Copyright (C) 1997-2007, 2011, 2015, 2016, MinGW.org Project.
+ * Copyright (C) 1997-2007, 2011, 2015-2018, MinGW.org Project.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -440,8 +440,14 @@ typedef struct __clockid__ *clockid_t;
 
 /* The standard clockid_t entities which we choose to support.
  */
-extern clockid_t CLOCK_REALTIME;
-extern clockid_t CLOCK_MONOTONIC;
+extern clockid_t const CLOCK_REALTIME;
+extern clockid_t const CLOCK_MONOTONIC;
+
+/* Ensure that these clock implementations are detectable via
+ * preprocessor #ifdef names.
+ */
+#define CLOCK_REALTIME CLOCK_REALTIME
+#define CLOCK_MONOTONIC CLOCK_MONOTONIC
 
 /* Prototypes for the standard POSIX functions which provide the
  * API to these standard clockid_t entities.
index 47183e3..3167616 100644 (file)
@@ -50,8 +50,8 @@ static struct __clockid__ clock_api[] =
 
 /* Publicly visible references to the preceding (opaque) clock definitions.
  */
-clockid_t CLOCK_REALTIME = &clock_api[CLOCK_TYPE_REALTIME];
-clockid_t CLOCK_MONOTONIC = &clock_api[CLOCK_TYPE_MONOTONIC];
+clockid_t const CLOCK_REALTIME = &clock_api[CLOCK_TYPE_REALTIME];
+clockid_t const CLOCK_MONOTONIC = &clock_api[CLOCK_TYPE_MONOTONIC];
 
 CLOCK_INLINE
 int64_t clock_api_getres_interval( clockid_t clock_api )