[Piglit] [PATCH] util: Include time.h on all platforms.
Brian Paul
brianp at vmware.com
Fri Nov 4 15:45:32 UTC 2016
On 11/03/2016 03:36 PM, Vinson Lee wrote:
> Fix MinGW build error.
>
> piglit-util.c: In function 'piglit_time_is_monotonic':
> piglit-util.c:583:18: error: storage size of 't' isn't known
> struct timespec t;
> ^
>
> Fixes: e0048f4940f7 ("util: Add piglit_delay_ns() api")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98486
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> tests/util/piglit-util.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
> index ef955b97dd26..6becfa664490 100644
> --- a/tests/util/piglit-util.c
> +++ b/tests/util/piglit-util.c
> @@ -32,7 +32,6 @@
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/syscall.h>
> -#include <time.h>
> #endif
>
> #include <assert.h>
> @@ -42,6 +41,7 @@
> #include <string.h>
> #include <errno.h>
> #include <inttypes.h>
> +#include <time.h>
>
> #if defined(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC) && defined(PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
> #include <pthread.h>
>
Hmm, I'm not seeing this problem with my MinGW setup here (version
4.6.3) but your patch does no harm either.
Reviewed-by: Brian Paul <brianp at vmware.com>
Tested-by: Brian Paul <brianp at vmware.com>
BTW, do you see this warning:
piglit/tests/util/piglit-util.c: In function ‘piglit_delay_ns’:
piglit/tests/util/piglit-util.c:634:2: warning: implicit declaration of
function ‘usleep’ [-Wimplicit-function-declaration]
Using Sleep(time_ns / 1000000) instead of usleep(time_ns / 1000) seems
to work. There's only caller of piglit_delay_ns() and it passes in 1
second so this change would be OK for the time being. I'm wondering how
practical ns sleeping is in any case.
-Brian
More information about the Piglit
mailing list