From 0fc3347a5cbe0d5c58a4ac3c75d05a93773002fb Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Sun, 31 Dec 2000 19:56:04 +0000 Subject: Fix problems with new EXACTLY_TWO_DASHES command line switch option. --- ld/ChangeLog | 5 +++++ ld/lexsup.c | 14 +++++++++++--- ld/testsuite/ChangeLog | 4 ++++ ld/testsuite/ld-srec/srec.exp | 4 ++-- 4 files changed, 22 insertions(+), 5 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 2e1b416..1822273 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2000-12-31 Nick Clifton + + * lexsup.c (parse_args): Set opterr to 0 and detect unparsed long + options by checking for a return value of '?' not -1. + 2000-12-28 Nick Clifton * lexsup.c (struct ld_option): Add new enum value: diff --git a/ld/lexsup.c b/ld/lexsup.c index eb1fc2d..80ccc6e 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -543,14 +543,22 @@ parse_args (argc, argv) /* getopt_long_only is like getopt_long, but '-' as well as '--' can indicate a long option. */ + opterr = 0; optc = getopt_long_only (argc, argv, shortopts, longopts, &longind); - if (optc == -1) - optc = getopt_long (argc, argv, shortopts, really_longopts, &longind); - + if (optc == '?') + { + --optind; + optc = getopt_long (argc, argv, shortopts, really_longopts, &longind); + } + if (optc == -1) break; + switch (optc) { + case '?': + fprintf (stderr, _("%s: unrecognized option '%s'\n"), + program_name, argv[optind - 1]); default: fprintf (stderr, _("%s: use the --help option for usage information\n"), diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index feca9e1..192e265 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2000-12-31 Nick Clifton + + * ld-srec/srec.exp: Use --oformat instead of -oformat. + 2000-12-09 Nick Clifton * ld-selective/selective.exp: Link in libgcc when target is v850. diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp index 818f847..f493f98 100644 --- a/ld/testsuite/ld-srec/srec.exp +++ b/ld/testsuite/ld-srec/srec.exp @@ -237,7 +237,7 @@ proc run_srec_test { test objs } { set flags "$flags --defsym __gccmain=0" # ARM targets cannot convert format in the linker - # using the -oformat command line switch + # using the --oformat command line switch setup_xfail "*arm*-*-*" setup_xfail "xscale-*-*" setup_xfail "thumb-*-*" @@ -259,7 +259,7 @@ proc run_srec_test { test objs } { } if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \ - || ![ld_simple_link $ld tmpdir/sr2.sr "$flags -oformat srec $objs"] } { + || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } { setup_xfail "hppa*-*-*elf*" fail $test return -- cgit v1.1