diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-02-11 21:36:30 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-06-27 10:01:15 +0200 |
commit | 28fff480efe376b9783cdb6a4128036a2fb7c47e (patch) | |
tree | f651fe92a2b92415a99d4a5e6f51b1aa1d662f4b | |
parent | 7214db763ab952771b10d8fdf72b902718f35902 (diff) |
modetest: Fix warnings
Enable all standard automake warnings except for -Wpointer-arith (as the
test pattern generation code uses void pointer arithmetics) and fix
them.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | tests/modetest/Makefile.am | 4 | ||||
-rw-r--r-- | tests/modetest/buffers.c | 13 | ||||
-rw-r--r-- | tests/modetest/buffers.h | 5 | ||||
-rw-r--r-- | tests/modetest/modetest.c | 44 |
4 files changed, 35 insertions, 31 deletions
diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am index 410c6326..6e7ff14f 100644 --- a/tests/modetest/Makefile.am +++ b/tests/modetest/Makefile.am @@ -1,4 +1,6 @@ -AM_CFLAGS = \ +AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS)) + +AM_CFLAGS += \ -I$(top_srcdir)/include/drm \ -I$(top_srcdir)/libkms/ \ -I$(top_srcdir) diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index b75cca70..1ca3be5f 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -999,8 +999,8 @@ fill_pattern(unsigned int format, enum fill_pattern pattern, void *planes[3], */ static struct kms_bo * -allocate_buffer(struct kms_driver *kms, - int width, int height, int *stride) +allocate_buffer(struct kms_driver *kms, unsigned int width, unsigned int height, + unsigned int *stride) { struct kms_bo *bo; unsigned bo_attribs[] = { @@ -1034,13 +1034,14 @@ allocate_buffer(struct kms_driver *kms, struct kms_bo * create_test_buffer(struct kms_driver *kms, unsigned int format, - int width, int height, int handles[4], - int pitches[4], int offsets[4], enum fill_pattern pattern) + unsigned int width, unsigned int height, + unsigned int handles[4], unsigned int pitches[4], + unsigned int offsets[4], enum fill_pattern pattern) { struct kms_bo *bo; - int ret, stride; - void *planes[3]; + void *planes[3] = { 0, }; void *virtual; + int ret; bo = allocate_buffer(kms, width, height, &pitches[0]); if (!bo) diff --git a/tests/modetest/buffers.h b/tests/modetest/buffers.h index 2b15ce50..e320389b 100644 --- a/tests/modetest/buffers.h +++ b/tests/modetest/buffers.h @@ -37,8 +37,9 @@ enum fill_pattern { }; struct kms_bo *create_test_buffer(struct kms_driver *kms, unsigned int format, - int width, int height, int handles[4], int pitches[4], - int offsets[4], enum fill_pattern pattern); + unsigned int width, unsigned int height, + unsigned int handles[4], unsigned int pitches[4], + unsigned int offsets[4], enum fill_pattern pattern); unsigned int format_fourcc(const char *name); diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 8afd2b13..47704db6 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -64,11 +64,11 @@ int fd, modes; struct type_name { int type; - char *name; + const char *name; }; #define type_name_fn(res) \ -char * res##_str(int type) { \ +const char * res##_str(int type) { \ unsigned int i; \ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ if (res##_names[i].type == type) \ @@ -85,7 +85,7 @@ struct type_name encoder_type_names[] = { { DRM_MODE_ENCODER_TVDAC, "TVDAC" }, }; -type_name_fn(encoder_type) +static type_name_fn(encoder_type) struct type_name connector_status_names[] = { { DRM_MODE_CONNECTED, "connected" }, @@ -93,7 +93,7 @@ struct type_name connector_status_names[] = { { DRM_MODE_UNKNOWNCONNECTION, "unknown" }, }; -type_name_fn(connector_status) +static type_name_fn(connector_status) struct type_name connector_type_names[] = { { DRM_MODE_CONNECTOR_Unknown, "unknown" }, @@ -113,11 +113,11 @@ struct type_name connector_type_names[] = { { DRM_MODE_CONNECTOR_eDP, "eDP" }, }; -type_name_fn(connector_type) +static type_name_fn(connector_type) #define bit_name_fn(res) \ -char * res##_str(int type) { \ - int i; \ +const char * res##_str(int type) { \ + unsigned int i; \ const char *sep = ""; \ for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \ if (type & (1 << i)) { \ @@ -138,7 +138,7 @@ static const char *mode_type_names[] = { "driver", }; -bit_name_fn(mode_type) +static bit_name_fn(mode_type) static const char *mode_flag_names[] = { "phsync", @@ -157,9 +157,9 @@ static const char *mode_flag_names[] = { "clkdiv2" }; -bit_name_fn(mode_flag) +static bit_name_fn(mode_flag) -void dump_encoders(void) +static void dump_encoders(void) { drmModeEncoder *encoder; int i; @@ -185,7 +185,7 @@ void dump_encoders(void) printf("\n"); } -void dump_mode(drmModeModeInfo *mode) +static void dump_mode(drmModeModeInfo *mode) { printf(" %s %d %d %d %d %d %d %d %d %d", mode->name, @@ -301,7 +301,7 @@ dump_prop(uint32_t prop_id, uint64_t value) drmModeFreeProperty(prop); } -void dump_connectors(void) +static void dump_connectors(void) { drmModeConnector *connector; int i, j; @@ -347,7 +347,7 @@ void dump_connectors(void) printf("\n"); } -void dump_crtcs(void) +static void dump_crtcs(void) { drmModeCrtc *crtc; drmModeObjectPropertiesPtr props; @@ -389,7 +389,7 @@ void dump_crtcs(void) printf("\n"); } -void dump_framebuffers(void) +static void dump_framebuffers(void) { drmModeFB *fb; int i; @@ -574,7 +574,7 @@ connector_find_mode(struct connector *c) /* and figure out which crtc index it is: */ for (i = 0; i < resources->count_crtcs; i++) { - if (c->crtc == resources->crtcs[i]) { + if (c->crtc == (int)resources->crtcs[i]) { c->pipe = i; break; } @@ -584,7 +584,7 @@ connector_find_mode(struct connector *c) /* -------------------------------------------------------------------------- */ -void +static void page_flip_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) { @@ -622,7 +622,7 @@ set_plane(struct kms_driver *kms, struct connector *c, struct plane *p) uint32_t plane_id = 0; struct kms_bo *plane_bo; uint32_t plane_flags = 0; - int ret, crtc_x, crtc_y, crtc_w, crtc_h; + int crtc_x, crtc_y, crtc_w, crtc_h; unsigned int i; /* find an unused plane which can be connected to our crtc */ @@ -861,7 +861,7 @@ static int parse_connector(struct connector *c, const char *arg) arg = endp + 1; p = strchrnul(arg, '@'); - len = min(sizeof c->mode_str - 1, p - arg); + len = min(sizeof c->mode_str - 1, (unsigned int)(p - arg)); strncpy(c->mode_str, arg, len); c->mode_str[len] = '\0'; @@ -883,7 +883,7 @@ static int parse_plane(struct plane *p, const char *arg) { strcpy(p->format_str, "XR24"); - if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, &p->format_str) != 4 && + if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, p->format_str) != 4 && sscanf(arg, "%d:%dx%d", &p->con_id, &p->w, &p->h) != 3) return -1; @@ -896,7 +896,7 @@ static int parse_plane(struct plane *p, const char *arg) return 0; } -void usage(char *name) +static void usage(char *name) { fprintf(stderr, "usage: %s [-ecpmf]\n", name); fprintf(stderr, "\t-e\tlist encoders\n"); @@ -939,11 +939,11 @@ int main(int argc, char **argv) int c; int encoders = 0, connectors = 0, crtcs = 0, planes = 0, framebuffers = 0; int test_vsync = 0; - char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos" }; + const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos" }; unsigned int i; int count = 0, plane_count = 0; struct connector con_args[2]; - struct plane plane_args[2] = {0}; + struct plane plane_args[2] = { { 0, }, }; opterr = 0; while ((c = getopt(argc, argv, optstr)) != -1) { |