Mesa (master): vc4: use intmax_t for formatted output of timespec members

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 5 07:14:10 UTC 2020


Module: Mesa
Branch: master
Commit: e331fd7fc42175aa7f466c96f1fcf42777909c9b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e331fd7fc42175aa7f466c96f1fcf42777909c9b

Author: Khem Raj <raj.khem at gmail.com>
Date:   Wed Dec  4 14:15:28 2019 -0800

vc4: use intmax_t for formatted output of timespec members

32bit architectures which have 64bit time_t does not fit the assumption
of time_t being same as system long int

Fixes
error: format specifies type 'long' but the argument has type 'time_t' (aka 'long long') [-Werror,-Wformat]
                        time.tv_sec);
                        ^~~~~~~~~~~

Signed-off-by: Khem Raj <raj.khem at gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2966>

---

 src/gallium/drivers/v3d/v3d_bufmgr.c | 4 ++--
 src/gallium/drivers/vc4/vc4_bufmgr.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3d_bufmgr.c b/src/gallium/drivers/v3d/v3d_bufmgr.c
index 48f5a54936c..e27395fa035 100644
--- a/src/gallium/drivers/v3d/v3d_bufmgr.c
+++ b/src/gallium/drivers/v3d/v3d_bufmgr.c
@@ -72,8 +72,8 @@ v3d_bo_dump_stats(struct v3d_screen *screen)
 
                 struct timespec time;
                 clock_gettime(CLOCK_MONOTONIC, &time);
-                fprintf(stderr, "  now:               %ld\n",
-                        (long)time.tv_sec);
+                fprintf(stderr, "  now:               %jd\n",
+                        (intmax_t)time.tv_sec);
         }
 }
 
diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
index a786e8ee939..975d49e2e77 100644
--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
+++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
@@ -99,8 +99,8 @@ vc4_bo_dump_stats(struct vc4_screen *screen)
 
                 struct timespec time;
                 clock_gettime(CLOCK_MONOTONIC, &time);
-                fprintf(stderr, "  now:               %ld\n",
-                        (long)time.tv_sec);
+                fprintf(stderr, "  now:               %jd\n",
+                        (intmax_t)time.tv_sec);
         }
 }
 



More information about the mesa-commit mailing list