Martin Storsjö wrote:
On Mon, 3 May 2021, Martin Storsjö wrote:
On Mon, 3 May 2021, Christian Franke wrote:
Liu Hao wrote:
在 2021-05-03 14:49, Martin Storsjö 写道:
Just for the record - I wouldn't mind applying the patch or
something like it. I agree with the arguments that it would be
beneficial to get more precision here, even if one in general
maybe can argue that we don't strictly need to provide such
precision.
Oh fair enough, if you would like it, I don't mind applying it either.
Attached is a new patch with '_Atomic' and 'intptr_t' as requested.
This version actually fails to compile with clang, with errors like
these:
../misc/gettimeofday.c:45:74: error: initializer element is not a
compile-time constant
static _Atomic GetSystemTimeAsFileTime_t GetSystemTimeAsFileTime_p
= NULL;
^~~~
/home/martin/clang-trunk/i686-w64-mingw32/include/time.h:91:14: note:
expanded from macro 'NULL'
#define NULL ((void *)0)
^~~~~~~~~~~
It seems like it's impossible to provide an initializer to an _Atomic
variable with clang, if it's a function pointer type, while a regular
pointer can be initialized just fine that way.
Well not actually impossible, but impractical.
If you'd use ((GetSystemTimeAsFileTime_t)0) as initializer, instead of
NULL (which expands to ((void*)0) ) it does actually seem to work.
Would plain '... = 0' without cast also work ? IIRC it should since C89 :-)
Alternative: Leave '/* = 0 */' only as a comment. There is no need to
set a static variable to 0.
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public