This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [RFA] Correct problem in s390-opc.tab generation


> From Andreas Krebbel
> I think this is the correct fix.  Please apply.
> 
> Thanks!

  Thanks, I committed the patch...
but realized afterwards that there was still something missing:
  If sscanf call fails to return all 6 parameters,
there is some output to stderr, but the program still
goes on, and even doesn't exit with an exit code different from zero.

  I tested it by adding a single dummy line at the end of s390-opc.txt:
a09b testdummy S_RD "Very long check for too long description to test new patch that should create a failure in s390-mkopc program" z196 zarch
There is some output to stderr, but the compliation still goes no...
 
  Here is a second tiny patch that adds an exit (1),
so that the failed line creates a compilation failure.

  This patch makes the program more consistent as it
calls 'exit (1)' in each case of a parsing problem.

  Is this OK?


2010-09-30  Pierre Muller  <muller@ics.u-strasbg.fr>

	* s390-mkopc.c (main): Exit with error 1 if sscanf fails
	to parse all 6 parameters.

Index: s390-mkopc.c
===================================================================
RCS file: /cvs/src/src/opcodes/s390-mkopc.c,v
retrieving revision 1.17
diff -u -p -r1.17 s390-mkopc.c
--- s390-mkopc.c        30 Sep 2010 11:32:15 -0000      1.17
+++ s390-mkopc.c        30 Sep 2010 12:41:54 -0000
@@ -393,7 +393,10 @@ main (void)
          insertExpandedMnemonic (opcode, mnemonic, format, min_cpu, mode_bits);
        }
       else
-        fprintf (stderr, "Couldn't scan line %s\n", currentLine);
+        {
+         fprintf (stderr, "Couldn't scan line %s\n", currentLine);
+         exit (1);
+       }
     }

   dumpTable ();



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]