public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: opcodes i386 and ia64 gen file warnings
Date: Sat, 26 Aug 2023 11:22:00 +0930	[thread overview]
Message-ID: <ZOlawCA30r9oot77@squeak.grove.modra.org> (raw)

i386: warning: format ‘%u’ expects argument of type ‘unsigned int’,
but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
ia64: warning: ignoring return value of ‘fgets’

	* i386-gen.c (process_i386_opcodes): Correct format string.
	* ia64-gen.c (load_insn_classes, load_depfile): Don't ignore
	fgets return value.

diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 30430a2f58a..c46d6a5e88d 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1841,7 +1841,7 @@ process_i386_opcodes (FILE *table)
 	  fprintf (fp, "#define MN_%s ", str);
 	  free (str);
 	  str = mkident (next);
-	  fprintf (fp, "(MN_%s + %u)\n", str, l1 - l);
+	  fprintf (fp, "(MN_%s + %zu)\n", str, l1 - l);
 	}
       else
 	{
diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c
index ad91e77248e..0118dd78757 100644
--- a/opcodes/ia64-gen.c
+++ b/opcodes/ia64-gen.c
@@ -607,7 +607,8 @@ load_insn_classes (void)
     fail (_("can't find ia64-ic.tbl for reading\n"));
 
   /* Discard first line.  */
-  fgets (buf, sizeof(buf), fp);
+  if (fgets (buf, sizeof(buf), fp) == NULL)
+    return;
 
   while (!feof (fp))
     {
@@ -808,7 +809,8 @@ load_depfile (const char *filename, enum ia64_dependency_mode mode)
   if (fp == NULL)
     fail (_("can't find %s for reading\n"), filename);
 
-  fgets (buf, sizeof(buf), fp);
+  if (fgets (buf, sizeof(buf), fp) == NULL)
+    return;
   while (!feof (fp))
     {
       char *name, *tmp;

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2023-08-26  1:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOlawCA30r9oot77@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).