[PATCH 1/5 libdrm] modetest: fix some compiler warnings

Paulo Zanoni przanoni at gmail.com
Tue Mar 20 07:51:26 PDT 2012


From: Paulo Zanoni <paulo.r.zanoni at intel.com>

Use unsigned int instead of int:
- modetest.c:89:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:97:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:117:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:772:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

The 'fd' variable is global, we don't need to pass it as an argument:
- modetest.c:698:40: warning: unused parameter ‘fd’ [-Wunused-parameter]

We don't use the 'modeset' variable:
- modetest.c:725:8: warning: variable ‘modeset’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 tests/modetest/modetest.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 229ab8a..c0f7ad7 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -70,7 +70,7 @@ struct type_name {
 
 #define type_name_fn(res) \
 char * res##_str(int type) {			\
-	int i;						\
+	unsigned int i;					\
 	for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
 		if (res##_names[i].type == type)	\
 			return res##_names[i].name;	\
@@ -695,7 +695,7 @@ void usage(char *name)
 
 #define dump_resource(res) if (res) dump_##res()
 
-static int page_flipping_supported(int fd)
+static int page_flipping_supported(void)
 {
 	/*FIXME: generic ioctl needed? */
 	return 1;
@@ -722,8 +722,8 @@ int main(int argc, char **argv)
 	int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0;
 	int test_vsync = 0;
 	char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" };
-	char *modeset = NULL;
-	int i, count = 0;
+	unsigned int i;
+	int count = 0;
 	struct connector con_args[2];
 	
 	opterr = 0;
@@ -748,7 +748,6 @@ int main(int argc, char **argv)
 			test_vsync = 1;
 			break;
 		case 's':
-			modeset = strdup(optarg);
 			con_args[count].crtc = -1;
 			if (sscanf(optarg, "%d:%64s",
 				   &con_args[count].id,
@@ -780,7 +779,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (test_vsync && !page_flipping_supported(fd)) {
+	if (test_vsync && !page_flipping_supported()) {
 		fprintf(stderr, "page flipping not supported by drm.\n");
 		return -1;
 	}
-- 
1.7.9.1



More information about the dri-devel mailing list