From: Keith Marshall Date: Sun, 2 Sep 2018 19:28:38 +0000 (+0100) Subject: Make clockapi symbolic constants #ifdef detectable. X-Git-Tag: wsl-5.1.1-release~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d7a8655ff94cf06f4558a4a7d2b57c30ba2b5f47;p=mingw%2Fmingw-org-wsl.git Make clockapi symbolic constants #ifdef detectable. --- diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog index 9edae87..24c9f0a 100644 --- a/mingwrt/ChangeLog +++ b/mingwrt/ChangeLog @@ -1,3 +1,11 @@ +2018-09-02 Keith Marshall + + 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 Circumvent testsuite failure with GCC-7+. diff --git a/mingwrt/include/time.h b/mingwrt/include/time.h index d27add7..89f4b09 100644 --- a/mingwrt/include/time.h +++ b/mingwrt/include/time.h @@ -6,7 +6,7 @@ * $Id$ * * Written by Colin Peters - * 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. diff --git a/mingwrt/mingwex/clockapi.c b/mingwrt/mingwex/clockapi.c index 47183e3..3167616 100644 --- a/mingwrt/mingwex/clockapi.c +++ b/mingwrt/mingwex/clockapi.c @@ -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 )