[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] Remove some gcc warning



make.tmpl contains some commented-out CFLAGS.
They are sometimes useful to check the code,
e.g. signed/unsigned corresness, so I'm trying to
uncomment them before posting a patch.

Attached patch removes some of making-sense warnings
that appear when such additional CFLAGS are turned on.
(Most of them are attributing 'unused')

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Avoid some gcc warnings to improve s/n ratio:

filters/filter-md.c:22: warning: unused parameter 'f'

report/columns.h:21: warning: pointer of type 'void *' used in subtraction
report/columns.h:22: warning: pointer of type 'void *' used in subtraction
report/columns.h:23: warning: pointer of type 'void *' used in subtraction
...

snapshot/snapshot.c:216: warning: unused parameter 'events'

dmeventd_mirror.c:128: warning: unused parameter 'file'
dmeventd_mirror.c:129: warning: unused parameter 'line'
...

dmeventd_snapshot.c:57: warning: unused parameter 'file'
dmeventd_snapshot.c:58: warning: unused parameter 'line'
...

Index: LVM2.work/lib/filters/filter-md.c
===================================================================
--- LVM2.work.orig/lib/filters/filter-md.c
+++ LVM2.work/lib/filters/filter-md.c
@@ -19,7 +19,8 @@
 
 #ifdef linux
 
-static int _ignore_md(struct dev_filter *f, struct device *dev)
+static int _ignore_md(struct dev_filter *f __attribute((unused)),
+		      struct device *dev)
 {
 	int ret;
 	
Index: LVM2.work/lib/report/report.c
===================================================================
--- LVM2.work.orig/lib/report/report.c
+++ LVM2.work/lib/report/report.c
@@ -1049,7 +1049,7 @@ static const struct dm_report_object_typ
 
 #define STR DM_REPORT_FIELD_TYPE_STRING
 #define NUM DM_REPORT_FIELD_TYPE_NUMBER
-#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((void *)&_dummy._ ## strct.field - (void *)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
+#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((uintptr_t)&_dummy._ ## strct.field - (uintptr_t)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
 
 static struct dm_report_field_type _fields[] = {
 #include "columns.h"
Index: LVM2.work/lib/snapshot/snapshot.c
===================================================================
--- LVM2.work.orig/lib/snapshot/snapshot.c
+++ LVM2.work/lib/snapshot/snapshot.c
@@ -213,7 +213,8 @@ static int _target_registered(struct lv_
 }
 
 /* FIXME This gets run while suspended and performs banned operations. */
-static int _target_set_events(struct lv_segment *seg, int events, int set)
+static int _target_set_events(struct lv_segment *seg,
+			      int events __attribute((unused)), int set)
 {
 	char *dso, *name;
 	struct volume_group *vg = seg->lv->vg;
Index: LVM2.work/dmeventd/mirror/dmeventd_mirror.c
===================================================================
--- LVM2.work.orig/dmeventd/mirror/dmeventd_mirror.c
+++ LVM2.work/dmeventd/mirror/dmeventd_mirror.c
@@ -125,8 +125,9 @@ out_parse:
 	return ME_IGNORE;
 }
 
-static void _temporary_log_fn(int level, const char *file,
-			      int line, const char *format)
+static void _temporary_log_fn(int level, const char *file __attribute((unused)),
+			      int line __attribute((unused)),
+			      const char *format)
 {
 	if (!strncmp(format, "WARNING: ", 9) && (level < 5))
 		syslog(LOG_CRIT, "%s", format);
@@ -164,7 +165,8 @@ static int _remove_failed_devices(const 
 	return (r == 1) ? 0 : -1;
 }
 
-void process_event(struct dm_task *dmt, enum dm_event_mask event,
+void process_event(struct dm_task *dmt,
+		   enum dm_event_mask event __attribute((unused)),
 		   void **unused __attribute((unused)))
 {
 	void *next = NULL;
@@ -222,8 +224,11 @@ void process_event(struct dm_task *dmt, 
 	pthread_mutex_unlock(&_event_mutex);
 }
 
-int register_device(const char *device, const char *uuid, int major, int minor,
-		   void **unused __attribute((unused)))
+int register_device(const char *device,
+		    const char *uuid __attribute((unused)),
+		    int major __attribute((unused)),
+		    int minor __attribute((unused)),
+		    void **unused __attribute((unused)))
 {
 	int r = 0;
 
@@ -259,8 +264,11 @@ out:
 	return r;
 }
 
-int unregister_device(const char *device, const char *uuid, int major, int minor,
-		   void **unused __attribute((unused)))
+int unregister_device(const char *device,
+		      const char *uuid __attribute((unused)),
+		      int major __attribute((unused)),
+		      int minor __attribute((unused)),
+		      void **unused __attribute((unused)))
 {
 	pthread_mutex_lock(&_register_mutex);
 
Index: LVM2.work/dmeventd/snapshot/dmeventd_snapshot.c
===================================================================
--- LVM2.work.orig/dmeventd/snapshot/dmeventd_snapshot.c
+++ LVM2.work/dmeventd/snapshot/dmeventd_snapshot.c
@@ -54,8 +54,10 @@ struct snap_status {
  */
 static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static void _temporary_log_fn(int level, const char *file,
-			      int line, const char *format)
+static void _temporary_log_fn(int level,
+			      const char *file __attribute((unused)),
+			      int line __attribute((unused)),
+			      const char *format)
 {
 	if (!strncmp(format, "WARNING: ", 9) && (level < 5))
 		syslog(LOG_CRIT, "%s", format);
@@ -115,7 +117,8 @@ fail:
 	dm_event_handler_destroy(dmevh);
 }
 
-void process_event(struct dm_task *dmt, enum dm_event_mask event,
+void process_event(struct dm_task *dmt,
+		   enum dm_event_mask event __attribute((unused)),
 		   void **private)
 {
 	void *next = NULL;
@@ -161,8 +164,11 @@ out:
 	pthread_mutex_unlock(&_event_mutex);
 }
 
-int register_device(const char *device, const char *uuid, int major, int minor,
-		   void **private)
+int register_device(const char *device,
+		    const char *uuid __attribute((unused)),
+		    int major __attribute((unused)),
+		    int minor __attribute((unused)),
+		    void **private)
 {
 	int r = 0;
 	int *percent_warning = (int*)private;
@@ -201,8 +207,11 @@ out:
 	return r;
 }
 
-int unregister_device(const char *device, const char *uuid, int major, int minor,
-		   void **unused __attribute((unused)))
+int unregister_device(const char *device,
+		      const char *uuid __attribute((unused)),
+		      int major __attribute((unused)),
+		      int minor __attribute((unused)),
+		      void **unused __attribute((unused)))
 {
 	pthread_mutex_lock(&_register_mutex);
 
Index: LVM2.work/lib/mirror/mirrored.c
===================================================================
--- LVM2.work.orig/lib/mirror/mirrored.c
+++ LVM2.work/lib/mirror/mirrored.c
@@ -456,7 +456,8 @@ static int _target_monitored(struct lv_s
 }
 
 /* FIXME This gets run while suspended and performs banned operations. */
-static int _target_set_events(struct lv_segment *seg, int evmask, int set)
+static int _target_set_events(struct lv_segment *seg,
+			      int evmask __attribute((unused)), int set)
 {
 	char *dso, *name;
 	struct logical_volume *lv;
Index: LVM2.work/tools/lvm-static.c
===================================================================
--- LVM2.work.orig/tools/lvm-static.c
+++ LVM2.work/tools/lvm-static.c
@@ -20,7 +20,8 @@ int main(int argc, char **argv)
 	return lvm2_main(argc, argv, 1);
 }
 
-int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
+int lvm_shell(struct cmd_context *cmd __attribute((unused)),
+	      struct cmdline_context *cmdline __attribute((unused)))
 {
 	return 0;
 }
Index: LVM2.work/tools/lvm.c
===================================================================
--- LVM2.work.orig/tools/lvm.c
+++ LVM2.work/tools/lvm.c
@@ -121,7 +121,8 @@ static char *_list_args(const char *text
 }
 
 /* Custom completion function */
-static char **_completion(const char *text, int start_pos, int end_pos)
+static char **_completion(const char *text, int start_pos,
+			  int end_pos __attribute((unused)))
 {
 	char **match_list = NULL;
 	int p = 0;
Index: LVM2.work/tools/lvm2cmd.c
===================================================================
--- LVM2.work.orig/tools/lvm2cmd.c
+++ LVM2.work/tools/lvm2cmd.c
@@ -20,7 +20,8 @@ void *lvm2_init(void)
 	return cmdlib_lvm2_init(0);
 }
 
-int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
+int lvm_shell(struct cmd_context *cmd __attribute((unused)),
+	      struct cmdline_context *cmdline __attribute((unused)))
 {
 	return 0;
 }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]