This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: [RFA] Correct problem in s390-opc.tab generation
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Andreas Krebbel'" <krebbel at linux dot vnet dot ibm dot com>
- Cc: <binutils at sourceware dot org>, <schwidefsky at de dot ibm dot com>
- Date: Thu, 30 Sep 2010 14:56:36 +0200
- Subject: RE: [RFA] Correct problem in s390-opc.tab generation
- References: <000c01cb5fec$83e38e00$8baaaa00$@muller@ics-cnrs.unistra.fr> <20100930105345.GA3508@bart>
> 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 ();