This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
gas warning fix
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Mon, 21 Feb 2005 13:34:28 +1030
- Subject: gas warning fix
c might be used uninitialized sez gcc-3.4
* input-file.c (input_file_open): Rearrange to avoid warning.
Index: gas/input-file.c
===================================================================
RCS file: /cvs/src/src/gas/input-file.c,v
retrieving revision 1.15
diff -u -p -r1.15 input-file.c
--- gas/input-file.c 19 Dec 2003 15:23:41 -0000 1.15
+++ gas/input-file.c 21 Feb 2005 02:59:55 -0000
@@ -146,21 +146,26 @@ input_file_open (char *filename, /* "" m
file_name = _("{standard input}");
}
- if (f_in)
- c = getc (f_in);
+ if (f_in == NULL)
+ {
+#ifdef BFD_ASSEMBLER
+ bfd_set_error (bfd_error_system_call);
+#endif
+ as_perror (_("Can't open %s for reading"), file_name);
+ return;
+ }
+
+ c = getc (f_in);
- if (f_in == NULL || ferror (f_in))
+ if (ferror (f_in))
{
#ifdef BFD_ASSEMBLER
bfd_set_error (bfd_error_system_call);
#endif
as_perror (_("Can't open %s for reading"), file_name);
- if (f_in)
- {
- fclose (f_in);
- f_in = NULL;
- }
+ fclose (f_in);
+ f_in = NULL;
return;
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre