]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: improve unrecognized command line option diagnostic
authorJan Beulich <jbeulich@suse.com>
Wed, 7 Aug 2024 14:31:00 +0000 (16:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 7 Aug 2024 14:31:00 +0000 (16:31 +0200)
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.

gas/as.c
gas/testsuite/gas/arm/armv2-mp-bad.l
gas/testsuite/gas/arm/dotprod-legacy-arch.l
gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l

index 259dc0ee58047a76f191b7e4d616faa50677a7da..28aa4e38b346986de5c8645b76820cacd3b0f7cb 100644 (file)
--- 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 '?':
index eb97135033efa90519d42c3933af437fbc49493a..d0159b0c77b321d5a467c39791a1d5c5ca12abe5 100644 (file)
@@ -1,3 +1,3 @@
 Assembler messages:
 [^:]*: extension does not apply to the base architecture
-[^:]*: unrecognized option -march=armv2\+mp
+[^:]*: unrecognized option .*-march=armv2\+mp.*
index a627a36fb12b0e698a90d91da6506627c93ea45b..7bbdf6381b125e3ee6cfd166ba47398d8c1bcdb6 100644 (file)
@@ -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.*
index 76208d2bcbc396ccd1ca9d8e8c48011e56afae3d..a6fc3dcb7f01a8a4ccf7ecb4e8d593872641cdda 100644 (file)
@@ -1,3 +1,3 @@
 Assembler messages:
 [^:]*: extension does not apply to the base architecture
-[^:]*: unrecognized option -march=armv7\+idiv
+[^:]*: unrecognized option .*-march=armv7\+idiv.*