* [PATCH 1/1] kconfig: fix warning: ignoring return value, declared with attribute warn_unused_result
@ 2010-08-12 17:21 Jean Sacren
2010-08-12 19:31 ` Sam Ravnborg
0 siblings, 1 reply; 2+ messages in thread
From: Jean Sacren @ 2010-08-12 17:21 UTC (permalink / raw)
To: Michal Marek; +Cc: Jiri Kosina, Roman Zippel, linux-kbuild
Hush up the unnecessary gcc warnings when fwrite() or fgets() are
called.
Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Cc: stable <stable@kernel.org>
---
scripts/kconfig/conf.c | 6 ++++--
scripts/kconfig/confdata.c | 8 +++++---
scripts/kconfig/expr.c | 3 ++-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 9960d1c..beaa533 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -77,6 +77,7 @@ static void check_stdin(void)
static int conf_askvalue(struct symbol *sym, const char *def)
{
+ char *dummy;
enum symbol_type type = sym_get_type(sym);
if (!sym_has_value(sym))
@@ -102,7 +103,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
check_stdin();
case ask_all:
fflush(stdout);
- fgets(line, 128, stdin);
+ dummy = fgets(line, 128, stdin);
return 1;
default:
break;
@@ -230,6 +231,7 @@ static int conf_choice(struct menu *menu)
struct menu *child;
int type;
bool is_new;
+ char *dummy;
sym = menu->sym;
type = sym_get_type(sym);
@@ -304,7 +306,7 @@ static int conf_choice(struct menu *menu)
check_stdin();
case ask_all:
fflush(stdout);
- fgets(line, 128, stdin);
+ dummy = fgets(line, 128, stdin);
strip(line);
if (line[0] == '?') {
print_help(menu);
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c4dec80..52c6c3d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -408,6 +408,7 @@ int conf_write(const char *name)
time_t now;
int use_timestamp = 1;
char *env;
+ size_t dummy;
dirname[0] = 0;
if (name && name[0]) {
@@ -505,7 +506,7 @@ int conf_write(const char *name)
while (1) {
l = strcspn(str, "\"\\");
if (l) {
- fwrite(str, l, 1, out);
+ dummy = fwrite(str, l, 1, out);
str += l;
}
if (!*str)
@@ -680,6 +681,7 @@ int conf_write_autoconf(void)
FILE *out, *tristate, *out_h;
time_t now;
int i, l;
+ size_t dummy;
sym_clear_all_valid();
@@ -756,8 +758,8 @@ int conf_write_autoconf(void)
while (1) {
l = strcspn(str, "\"\\");
if (l) {
- fwrite(str, l, 1, out);
- fwrite(str, l, 1, out_h);
+ dummy = fwrite(str, l, 1, out);
+ dummy = fwrite(str, l, 1, out_h);
str += l;
}
if (!*str)
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index d83f232..99a058d 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1087,7 +1087,8 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
{
- fwrite(str, strlen(str), 1, data);
+ size_t dummy;
+ dummy = fwrite(str, strlen(str), 1, data);
}
void expr_fprint(struct expr *e, FILE *out)
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] kconfig: fix warning: ignoring return value, declared with attribute warn_unused_result
2010-08-12 17:21 [PATCH 1/1] kconfig: fix warning: ignoring return value, declared with attribute warn_unused_result Jean Sacren
@ 2010-08-12 19:31 ` Sam Ravnborg
0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2010-08-12 19:31 UTC (permalink / raw)
To: Jean Sacren; +Cc: Michal Marek, Jiri Kosina, Roman Zippel, linux-kbuild
On Thu, Aug 12, 2010 at 11:21:22AM -0600, Jean Sacren wrote:
> Hush up the unnecessary gcc warnings when fwrite() or fgets() are
> called.
>
> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> Cc: stable <stable@kernel.org>
I actullay liked the first version you posted better than this.
But ayway a few comments:
- Please always include the warning you fix.
This makes it much easier to ask google if a patch for the
same issue already exists
- Please redo the patch on top of Linus-latest.
We refactored some code and this patch will no longer apply
- Please cc: Mike Frysinger as he sent a patch to fix the same warnings
Sam
> ---
> scripts/kconfig/conf.c | 6 ++++--
> scripts/kconfig/confdata.c | 8 +++++---
> scripts/kconfig/expr.c | 3 ++-
> 3 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
> index 9960d1c..beaa533 100644
> --- a/scripts/kconfig/conf.c
> +++ b/scripts/kconfig/conf.c
> @@ -77,6 +77,7 @@ static void check_stdin(void)
>
> static int conf_askvalue(struct symbol *sym, const char *def)
> {
> + char *dummy;
> enum symbol_type type = sym_get_type(sym);
>
> if (!sym_has_value(sym))
> @@ -102,7 +103,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
> check_stdin();
> case ask_all:
> fflush(stdout);
> - fgets(line, 128, stdin);
> + dummy = fgets(line, 128, stdin);
> return 1;
> default:
> break;
> @@ -230,6 +231,7 @@ static int conf_choice(struct menu *menu)
> struct menu *child;
> int type;
> bool is_new;
> + char *dummy;
>
> sym = menu->sym;
> type = sym_get_type(sym);
> @@ -304,7 +306,7 @@ static int conf_choice(struct menu *menu)
> check_stdin();
> case ask_all:
> fflush(stdout);
> - fgets(line, 128, stdin);
> + dummy = fgets(line, 128, stdin);
> strip(line);
> if (line[0] == '?') {
> print_help(menu);
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index c4dec80..52c6c3d 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -408,6 +408,7 @@ int conf_write(const char *name)
> time_t now;
> int use_timestamp = 1;
> char *env;
> + size_t dummy;
>
> dirname[0] = 0;
> if (name && name[0]) {
> @@ -505,7 +506,7 @@ int conf_write(const char *name)
> while (1) {
> l = strcspn(str, "\"\\");
> if (l) {
> - fwrite(str, l, 1, out);
> + dummy = fwrite(str, l, 1, out);
> str += l;
> }
> if (!*str)
> @@ -680,6 +681,7 @@ int conf_write_autoconf(void)
> FILE *out, *tristate, *out_h;
> time_t now;
> int i, l;
> + size_t dummy;
>
> sym_clear_all_valid();
>
> @@ -756,8 +758,8 @@ int conf_write_autoconf(void)
> while (1) {
> l = strcspn(str, "\"\\");
> if (l) {
> - fwrite(str, l, 1, out);
> - fwrite(str, l, 1, out_h);
> + dummy = fwrite(str, l, 1, out);
> + dummy = fwrite(str, l, 1, out_h);
> str += l;
> }
> if (!*str)
> diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
> index d83f232..99a058d 100644
> --- a/scripts/kconfig/expr.c
> +++ b/scripts/kconfig/expr.c
> @@ -1087,7 +1087,8 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
>
> static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
> {
> - fwrite(str, strlen(str), 1, data);
> + size_t dummy;
> + dummy = fwrite(str, strlen(str), 1, data);
> }
>
> void expr_fprint(struct expr *e, FILE *out)
> --
> 1.7.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-12 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12 17:21 [PATCH 1/1] kconfig: fix warning: ignoring return value, declared with attribute warn_unused_result Jean Sacren
2010-08-12 19:31 ` Sam Ravnborg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.