From patchwork Tue Jul 30 05:54:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 94754 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB6C53858410 for ; Tue, 30 Jul 2024 05:55:07 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id DFB133858C56 for ; Tue, 30 Jul 2024 05:54:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFB133858C56 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DFB133858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::636 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722318881; cv=none; b=SBUJDQFgYPjaSpM8fyldpBQ4g8tVRStRD8GFYfsb2cQsGUq86LRrbtVZTsisphwTXLF1PdY9Fo82xp94luP+o2uygkjDuMPU39cQqW6NEW6uXMyRcZHQs8Sx8wFX7RA1Gch3v7rFOMlfI8u7q/LCzyffv6m5pEhpjXO2HoNUBho= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722318881; c=relaxed/simple; bh=9eVFYSE96NbRzfPB8Ai/6Xljv2+BCq1ypsPcNODe+Rs=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=qlY0Z/UqeguKeDflQ22dlAdCXV2icUMIMo68aZvAMuTaY1a2skHTBf55er+nmb2wzOqdFRjCYdDo2sAIjyDppgXJmjk51JGIo8S4x1aA6UsYGI+m5x5rdtI6hfjQAHwvsPp+vw80h6DMaXmiPs6Wq2WWAX4kj+Rqkn5J+TsF1A0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a7a843bef98so437520466b.2 for ; Mon, 29 Jul 2024 22:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1722318878; x=1722923678; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3d61nv1IK9JSH7qjbNHNE2OviS93P0fqVqTrLMXyMV8=; b=LvrHE12Ecxc9K+mtqjkLwYXb85dn7Z8HdbV1FRogu87JrPCnOztorySL9EtMig12ve wtgCbbr90lSV4jYJLgpyecDM6kemmjuON8gvKeoJkT3jiwYHtawzMFvFOs2MVxWzKFzn ZPVG0aEFuPErwQbpghRjgW8/v5ZeCPPnaACuWcEPJ9H1ImlBR5VdBf85vkDml8b0oH/b B03HBFcgYy1lvQOEhEHhUYFbH9jcddKHtCp4T89wi3AXfqVy4Qy468FlV0/N9+n75SLQ GJkWIqIEm3aHhrL9uUbUFJTVwHV1ve2Av6Ro7/sA2eV43UkLXKM0c8UyAhtmDBJkVB+z laPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722318878; x=1722923678; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3d61nv1IK9JSH7qjbNHNE2OviS93P0fqVqTrLMXyMV8=; b=AEmCWjvm1VLFGAq7By3a4Z4uYxM37ZPhi/6Vzek+dHaFwd/wtEEbZzl/6RywHVXLOu RJDSyIYfJiQ1Oc/k52snCRDAJd4sK2b/9GKM93mwm/Uw2InkVuwE9izPfTmtWpE9ktCS wLZO8x4dPW6Til2bXqBCP4HEldOiqKVtdvinHDdo5/kzC4X6bfMwDC83uKCDy8jco5hl fsJ/AjHBbYeVI/teCwxQbDu7DwTOpHdLMwzYlVTzpNQVEYIVRqqRA+8bAZI0BcEYXHKx /8FOWP8rWeE7ZHJIKiVxMGiqojH4BcH8jVkMf1DqULYFZibRM91YKza9KtA3dwdSxNCp koRw== X-Gm-Message-State: AOJu0YzJWS0ZayrNTie57uIgA/dZT2KS3Ed1n2Mk6X9rT434B6m+5lp0 OXfz517EnXyFmFMirCMegk868+64suvuBC6aAC6eN7oW6KiLWH8PfsWee+CkNIxRi5aY2gyzzU4 = X-Google-Smtp-Source: AGHT+IHsxMP3FTCTnYbmjlMIASbYar1mqf4Raqarga2q0oh3NmcovTZfFO016FLVj0lStr4SPhTe1Q== X-Received: by 2002:a17:907:9694:b0:a77:cb8b:7a2d with SMTP id a640c23a62f3a-a7d4016612fmr761566166b.49.1722318878502; Mon, 29 Jul 2024 22:54:38 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab23157sm596468766b.33.2024.07.29.22.54.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jul 2024 22:54:38 -0700 (PDT) Message-ID: <9929fb72-1ab4-4719-8f22-7ccd594f73e9@suse.com> Date: Tue, 30 Jul 2024 07:54:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/4] gas: improve unrecognized command line option diagnostic From: Jan Beulich To: Binutils References: Content-Language: en-US Cc: Nick Clifton , "ramana.radhakrishnan@arm.com" , Richard Earnshaw Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/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pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3024.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org 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. --- 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 '?': --- 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.* --- 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.* --- 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.*