[Mesa-dev] [PATCH libdrm 1/1] Fix some gcc -Wextra warnings

Jan Vesely jan.vesely at rutgers.edu
Sun Nov 30 10:32:10 PST 2014


Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---

Two warning remain in my setup (radeon only):

tests/modeprint/modeprint.c:127 (-Wempty-body) I'm not sure what
should happen here, or why the if is even there. Didn't feel right to add {}
to shut up gcc

xf86drm.c:322 (-Wtype-limits) Not sure what the semantics of get_perm are.
Maybe replacing ">= 0" with "!= ~1U" is enough (if the only neg value it returns is -1)

 tests/vbltest/vbltest.c | 3 ++-
 xf86drm.c               | 4 ++--
 xf86drmMode.c           | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c
index cdc1ef6..6e13c57 100644
--- a/tests/vbltest/vbltest.c
+++ b/tests/vbltest/vbltest.c
@@ -104,7 +104,8 @@ static void usage(char *name)
 
 int main(int argc, char **argv)
 {
-	int i, c, fd, ret;
+	unsigned i;
+	int c, fd, ret;
 	char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "exynos", "omapdrm", "tilcdc", "msm", "tegra" };
 	drmVBlank vbl;
 	drmEventContext evctx;
diff --git a/xf86drm.c b/xf86drm.c
index d900b4b..e17b1a3 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -302,7 +302,7 @@ static int chown_check_return(const char *path, uid_t owner, gid_t group)
  * special file node with the major and minor numbers specified by \p dev and
  * parent directory if necessary and was called by root.
  */
-static int drmOpenDevice(long dev, int minor, int type)
+static int drmOpenDevice(dev_t dev, int minor, int type)
 {
     stat_t          st;
     char            buf[64];
@@ -2177,7 +2177,7 @@ int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
 int drmGetStats(int fd, drmStatsT *stats)
 {
     drm_stats_t s;
-    int         i;
+    unsigned    i;
 
     if (drmIoctl(fd, DRM_IOCTL_GET_STATS, &s))
 	return -errno;
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 60ce369..e3e599b 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -854,7 +854,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
 	len = read(fd, buffer, sizeof buffer);
 	if (len == 0)
 		return 0;
-	if (len < sizeof *e)
+	if (len < (int)sizeof *e)
 		return -1;
 
 	i = 0;
-- 
1.9.3



More information about the mesa-dev mailing list