[PATCH 2/3] lib: fwts_*: use FWTS_UNUSED on unused func args in fwts library

IvanHu ivan.hu at canonical.com
Mon Oct 29 17:35:39 UTC 2012


On 10/25/2012 06:48 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Now use FWTS_UNUSED() on all the relevant code in the fwts library
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_acpi_method.c   |    4 ++++
>   src/lib/src/fwts_battery.c       |    4 ++++
>   src/lib/src/fwts_button.c        |    2 ++
>   src/lib/src/fwts_cpu.c           |    4 ++++
>   src/lib/src/fwts_dump.c          |    2 ++
>   src/lib/src/fwts_framework.c     |    2 ++
>   src/lib/src/fwts_hwinfo.c        |    2 ++
>   src/lib/src/fwts_interactive.c   |    2 ++
>   src/lib/src/fwts_klog.c          |    6 ++++++
>   src/lib/src/fwts_log_html.c      |    8 ++++++++
>   src/lib/src/fwts_log_json.c      |   11 +++++++++++
>   src/lib/src/fwts_log_plaintext.c |    3 +++
>   src/lib/src/fwts_log_xml.c       |    7 +++++++
>   src/lib/src/fwts_memorymap.c     |    2 ++
>   src/lib/src/fwts_summary.c       |    2 ++
>   src/lib/src/fwts_uefi.c          |    2 ++
>   16 files changed, 63 insertions(+)
>
> diff --git a/src/lib/src/fwts_acpi_method.c b/src/lib/src/fwts_acpi_method.c
> index d9d9883..5a66b6d 100644
> --- a/src/lib/src/fwts_acpi_method.c
> +++ b/src/lib/src/fwts_acpi_method.c
> @@ -136,6 +136,8 @@ int fwts_method_deinit(fwts_framework *fw)
>   {
>   	int ret = FWTS_ERROR;
>
> +	FWTS_UNUSED(fw);
> +
>   	if (fwts_method_initialized) {
>   		fwts_list_free(fwts_object_names, free);
>   		fwts_object_names = NULL;
> @@ -283,6 +285,8 @@ ACPI_STATUS fwts_method_evaluate(fwts_framework *fw,
>           ACPI_OBJECT_LIST *arg_list,
>   	ACPI_BUFFER	 *buf)
>   {
> +	FWTS_UNUSED(fw);
> +
>           buf->Length  = ACPI_ALLOCATE_BUFFER;
>           buf->Pointer = NULL;
>
> diff --git a/src/lib/src/fwts_battery.c b/src/lib/src/fwts_battery.c
> index 1383de1..fc231c5 100644
> --- a/src/lib/src/fwts_battery.c
> +++ b/src/lib/src/fwts_battery.c
> @@ -633,6 +633,8 @@ int fwts_battery_get_name(
>   	int ret;
>   	DIR *dir;
>
> +	FWTS_UNUSED(fw);
> +
>   	if ((dir = opendir(FWTS_SYS_CLASS_POWER_SUPPLY)) != NULL) {
>   		ret = fwts_battery_get_name_sys_fs(dir, index, name);
>   		closedir(dir);
> @@ -651,6 +653,8 @@ int fwts_battery_get_count(fwts_framework *fw, int *count)
>   	int ret;
>   	DIR *dir;
>
> +	FWTS_UNUSED(fw);
> +
>   	if ((dir = opendir(FWTS_SYS_CLASS_POWER_SUPPLY)) != NULL) {
>   		ret = fwts_battery_get_count_sys_fs(dir, count);
>   		closedir(dir);
> diff --git a/src/lib/src/fwts_button.c b/src/lib/src/fwts_button.c
> index 2eb7d87..93c2d02 100644
> --- a/src/lib/src/fwts_button.c
> +++ b/src/lib/src/fwts_button.c
> @@ -118,6 +118,8 @@ int fwts_button_match_state(
>   	*matched = 0;
>   	*not_matched = 0;
>
> +	FWTS_UNUSED(fw);
> +
>   	if (access(FWTS_PROC_ACPI_BUTTON, R_OK) == 0)
>   		return fwts_button_match_state_proc(button, matched, not_matched);
>
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 06df9a7..80d7824 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -270,6 +270,8 @@ static void fwts_cpu_consume_kill(void)
>    */
>   static void fwts_cpu_consume_sighandler(int dummy)
>   {
> +	FWTS_UNUSED(dummy);
> +
>   	_exit(0);
>   }
>
> @@ -279,6 +281,8 @@ static void fwts_cpu_consume_sighandler(int dummy)
>    */
>   static void fwts_cpu_sigint_handler(int dummy)
>   {
> +	FWTS_UNUSED(dummy);
> +
>   	fwts_cpu_consume_kill();
>   	_exit(0);
>   }
> diff --git a/src/lib/src/fwts_dump.c b/src/lib/src/fwts_dump.c
> index fb69376..ebbb60c 100644
> --- a/src/lib/src/fwts_dump.c
> +++ b/src/lib/src/fwts_dump.c
> @@ -120,6 +120,8 @@ static int dump_exec(const char *path, const char *filename, const char *command
>    */
>   static int dump_dmidecode(fwts_framework *fw, const char *path, const char *filename)
>   {
> +	FWTS_UNUSED(fw);
> +
>   	return dump_exec(path, filename, FWTS_DMIDECODE_PATH);
>   }
>   #endif
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 1a7313d..e515e05 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -871,6 +871,8 @@ static int fwts_framework_log_type_parse(fwts_framework *fw, const char *arg)
>
>   int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const argv[], int option_char, int long_index)
>   {
> +	FWTS_UNUSED(argc);
> +
>   	switch (option_char) {
>   	case 0:
>   		switch (long_index) {
> diff --git a/src/lib/src/fwts_hwinfo.c b/src/lib/src/fwts_hwinfo.c
> index 995df6c..4365c64 100644
> --- a/src/lib/src/fwts_hwinfo.c
> +++ b/src/lib/src/fwts_hwinfo.c
> @@ -31,6 +31,8 @@
>    */
>   int fwts_hwinfo_get(fwts_framework *fw, fwts_hwinfo *hwinfo)
>   {
> +	FWTS_UNUSED(fw);
> +
>   	fwts_pipe_exec("lspci | grep Network", &hwinfo->network);
>   	fwts_pipe_exec("lspci | grep Ethernet", &hwinfo->ethernet);
>   	fwts_pipe_exec("ifconfig -a | grep -A1 '^\\w'", &hwinfo->ifconfig);
> diff --git a/src/lib/src/fwts_interactive.c b/src/lib/src/fwts_interactive.c
> index 07d3f39..be4249e 100644
> --- a/src/lib/src/fwts_interactive.c
> +++ b/src/lib/src/fwts_interactive.c
> @@ -64,6 +64,8 @@ int fwts_printf(fwts_framework *fw, const char *fmt, ...)
>   {
>   	int len;
>   	va_list ap;
> +	
> +	FWTS_UNUSED(fw);
>
>   	va_start(ap, fmt);
>   	len = vfprintf(stdout, fmt, ap);
> diff --git a/src/lib/src/fwts_klog.c b/src/lib/src/fwts_klog.c
> index 22f3b10..34e6c0f 100644
> --- a/src/lib/src/fwts_klog.c
> +++ b/src/lib/src/fwts_klog.c
> @@ -229,6 +229,8 @@ void fwts_klog_scan_patterns(fwts_framework *fw,
>   		"This is a bug picked up by the kernel, but as yet, the "
>   		"firmware test suite has no diagnostic advice for this particular problem.";
>
> +	FWTS_UNUSED(prevline);
> +
>   	while (pattern->pattern != NULL) {
>   		int matched = 0;
>   		switch (pattern->compare_mode) {
> @@ -429,6 +431,10 @@ static void fwts_klog_regex_find_callback(fwts_framework *fw, char *line, int re
>   	int rc;
>   	int vector[1];
>
> +	FWTS_UNUSED(fw);
> +	FWTS_UNUSED(repeated);
> +	FWTS_UNUSED(prev);
> +
>   	re = pcre_compile(pattern, 0, &error, &erroffset, NULL);
>   	if (re != NULL) {
>   		extra = pcre_study(re, 0, &error);
> diff --git a/src/lib/src/fwts_log_html.c b/src/lib/src/fwts_log_html.c
> index 27cba0c..c6d941a 100644
> --- a/src/lib/src/fwts_log_html.c
> +++ b/src/lib/src/fwts_log_html.c
> @@ -248,6 +248,9 @@ static int fwts_log_print_html(
>   	char *code_end;
>   	char *html_converted;
>
> +	FWTS_UNUSED(label);
> +	FWTS_UNUSED(prefix);
> +
>   	if (!((field & LOG_FIELD_MASK) & fwts_log_filter))
>   		return 0;
>
> @@ -354,6 +357,9 @@ static int fwts_log_print_html(
>    */
>   static void fwts_log_underline_html(fwts_log_file *log_file, const int ch)
>   {
> +	FWTS_UNUSED(log_file);
> +	FWTS_UNUSED(ch);
> +
>   	/* No-op for html */
>   }
>
> @@ -363,6 +369,8 @@ static void fwts_log_underline_html(fwts_log_file *log_file, const int ch)
>    */
>   static void fwts_log_newline_html(fwts_log_file *log_file)
>   {
> +	FWTS_UNUSED(log_file);
> +
>   	/* No-op for html */
>   }
>
> diff --git a/src/lib/src/fwts_log_json.c b/src/lib/src/fwts_log_json.c
> index 9afb74e..6d06622 100644
> --- a/src/lib/src/fwts_log_json.c
> +++ b/src/lib/src/fwts_log_json.c
> @@ -70,6 +70,8 @@ static int fwts_log_print_json(
>   	json_object *obj;
>   	char *str;
>
> +	FWTS_UNUSED(prefix);
> +
>   	if (!((field & LOG_FIELD_MASK) & fwts_log_filter))
>   		return 0;
>
> @@ -139,6 +141,9 @@ static int fwts_log_print_json(
>    */
>   static void fwts_log_underline_json(fwts_log_file *log_file, const int ch)
>   {
> +	FWTS_UNUSED(log_file);
> +	FWTS_UNUSED(ch);
> +
>   	/* No-op for json */
>   }
>
> @@ -148,6 +153,8 @@ static void fwts_log_underline_json(fwts_log_file *log_file, const int ch)
>    */
>   static void fwts_log_newline_json(fwts_log_file *log_file)
>   {
> +	FWTS_UNUSED(log_file);
> +
>   	/* No-op for json */
>   }
>
> @@ -156,6 +163,8 @@ static void fwts_log_section_begin_json(fwts_log_file *log_file, const char *nam
>   	json_object *json_obj;
>   	json_object *json_log;
>
> +	FWTS_UNUSED(log_file);
> +
>   	if ((json_obj = json_object_new_object()) == NULL)
>   		fwts_log_out_of_memory_json();
>
> @@ -186,6 +195,8 @@ static void fwts_log_section_begin_json(fwts_log_file *log_file, const char *nam
>
>   static void fwts_log_section_end_json(fwts_log_file *log_file)
>   {
> +	FWTS_UNUSED(log_file);
> +
>   	if (json_stack_index > 0)
>   		json_stack_index--;
>   	else {
> diff --git a/src/lib/src/fwts_log_plaintext.c b/src/lib/src/fwts_log_plaintext.c
> index 256c8a4..712f567 100644
> --- a/src/lib/src/fwts_log_plaintext.c
> +++ b/src/lib/src/fwts_log_plaintext.c
> @@ -111,6 +111,9 @@ static int fwts_log_print_plaintext(
>   	fwts_list *lines;
>   	fwts_list_link *item;
>
> +	FWTS_UNUSED(status);
> +	FWTS_UNUSED(label);
> +
>   	if (!((field & LOG_FIELD_MASK) & fwts_log_filter))
>   		return 0;
>
> diff --git a/src/lib/src/fwts_log_xml.c b/src/lib/src/fwts_log_xml.c
> index 47ec35c..c3fc787 100644
> --- a/src/lib/src/fwts_log_xml.c
> +++ b/src/lib/src/fwts_log_xml.c
> @@ -54,6 +54,8 @@ static int fwts_log_print_xml(
>   	time_t now;
>   	char *str;
>
> +	FWTS_UNUSED(prefix);
> +
>   	if (!((field & LOG_FIELD_MASK) & fwts_log_filter))
>   		return 0;
>
> @@ -113,6 +115,9 @@ static int fwts_log_print_xml(
>    */
>   static void fwts_log_underline_xml(fwts_log_file *log_file, const int ch)
>   {
> +	FWTS_UNUSED(log_file);
> +	FWTS_UNUSED(ch);
> +
>   	/* No-op for xml */
>   }
>
> @@ -122,6 +127,8 @@ static void fwts_log_underline_xml(fwts_log_file *log_file, const int ch)
>    */
>   static void fwts_log_newline_xml(fwts_log_file *log_file)
>   {
> +	FWTS_UNUSED(log_file);
> +
>   	/* No-op for xml */
>   }
>
> diff --git a/src/lib/src/fwts_memorymap.c b/src/lib/src/fwts_memorymap.c
> index fe5dd7b..83829e7 100644
> --- a/src/lib/src/fwts_memorymap.c
> +++ b/src/lib/src/fwts_memorymap.c
> @@ -228,6 +228,8 @@ fwts_list *fwts_memory_map_table_load_from_klog(fwts_framework *fw)
>   	fwts_list *klog;
>   	fwts_list *memory_map_list;
>
> +	FWTS_UNUSED(fw);
> +
>   	if ((klog = fwts_klog_read()) == NULL)
>   		return NULL;
>
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index c435aa5..623fa3b 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -127,6 +127,8 @@ int fwts_summary_add(
>   	bool summary_item_found = false;
>   	int index = fwts_summary_level_to_index(level);
>
> +	FWTS_UNUSED(fw);
> +
>   	/* Does the text already exist? - search for it */
>   	fwts_list_foreach(item, fwts_summaries[index]) {
>   		summary_item = fwts_list_data(fwts_summary_item *,item);
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index c4b2019..43bc850 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -347,6 +347,8 @@ void fwts_uefi_free_variable(fwts_uefi_var *var)
>
>   static int fwts_uefi_true_filter(const struct dirent *d)
>   {
> +	FWTS_UNUSED(d);
> +
>   	return 1;
>   }
>
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>




More information about the fwts-devel mailing list