aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-08-07 16:31:00 +0200
committerJan Beulich <jbeulich@suse.com>2024-08-07 16:31:00 +0200
commit544248c027aa17845f7b35efc11316892f9af326 (patch)
treeacacd8214e5d5d510718e16495be94d1402d2b62
parent643f8ace5c908224c74276c901274c0c48d36a68 (diff)
downloadgdb-544248c027aa17845f7b35efc11316892f9af326.zip
gdb-544248c027aa17845f7b35efc11316892f9af326.tar.gz
gdb-544248c027aa17845f7b35efc11316892f9af326.tar.bz2
gas: improve unrecognized command line option diagnostic
Printing optc with %c makes sense only when optc is actually a character. Add logic to also deal with unrecognized long options, rejected by md_parse_option() rather than get_opt_long_only(). Also quote the reproduced strings, such that possible included whitespace can be recognized.
-rw-r--r--gas/as.c6
-rw-r--r--gas/testsuite/gas/arm/armv2-mp-bad.l2
-rw-r--r--gas/testsuite/gas/arm/dotprod-legacy-arch.l2
-rw-r--r--gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l2
4 files changed, 8 insertions, 4 deletions
diff --git a/gas/as.c b/gas/as.c
index 259dc0e..28aa4e3 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -666,8 +666,12 @@ parse_args (int * pargc, char *** pargv)
verbose = 1;
break;
}
+ else if (is_a_char (optc))
+ as_bad (_("unrecognized option `-%c%s'"), optc, optarg ? optarg : "");
+ else if (optarg)
+ as_bad (_("unrecognized option `--%s=%s'"), longopts[longind].name, optarg);
else
- as_bad (_("unrecognized option -%c%s"), optc, optarg ? optarg : "");
+ as_bad (_("unrecognized option `--%s'"), longopts[longind].name);
/* Fall through. */
case '?':
diff --git a/gas/testsuite/gas/arm/armv2-mp-bad.l b/gas/testsuite/gas/arm/armv2-mp-bad.l
index eb97135..d0159b0 100644
--- a/gas/testsuite/gas/arm/armv2-mp-bad.l
+++ b/gas/testsuite/gas/arm/armv2-mp-bad.l
@@ -1,3 +1,3 @@
Assembler messages:
[^:]*: extension does not apply to the base architecture
-[^:]*: unrecognized option -march=armv2\+mp
+[^:]*: unrecognized option .*-march=armv2\+mp.*
diff --git a/gas/testsuite/gas/arm/dotprod-legacy-arch.l b/gas/testsuite/gas/arm/dotprod-legacy-arch.l
index a627a36..7bbdf63 100644
--- a/gas/testsuite/gas/arm/dotprod-legacy-arch.l
+++ b/gas/testsuite/gas/arm/dotprod-legacy-arch.l
@@ -1,3 +1,3 @@
Assembler messages:
[^:]*: extension does not apply to the base architecture
-[^:]*: unrecognized option -march=armv8.1-a\+dotprod
+[^:]*: unrecognized option .*-march=armv8\.1-a\+dotprod.*
diff --git a/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l
index 76208d2..a6fc3dc 100644
--- a/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l
+++ b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l
@@ -1,3 +1,3 @@
Assembler messages:
[^:]*: extension does not apply to the base architecture
-[^:]*: unrecognized option -march=armv7\+idiv
+[^:]*: unrecognized option .*-march=armv7\+idiv.*