From patchwork Mon Sep 18 18:26:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 815070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-462425-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="dzfJJSlO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xwvbs0h9rz9s7B for ; Tue, 19 Sep 2017 04:26:47 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:reply-to:to:date:content-type :mime-version; q=dns; s=default; b=BN2t2FfQgpnSvHLJRxX0DxSaKRgrF O+HE/vit781EmZMIHZ5bCGvgf3brjQvhjgXUeOoF6tgGH1DPxkY6B5cud50ZJA9B bNfwDjLLBITzxhwdd3womNPGJZojxoJtW/Jlj3IOre/DR5oWHDuT1j+AZzVj0Y/o uoB6fN2k9PlRVg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:reply-to:to:date:content-type :mime-version; s=default; bh=mo47qOtP+fas5D2rphLfttjReWw=; b=dzf JJSlOp/vKurP67GHUywQTihPjf5lBGDpIi0NqXnkKzbthPoFb4+ALi1pjVvjS7v9 VYD+PXIuqFCt/YxEh7b+hgPlxmbt250MDvGjEWFfE9HYloh+R8LaDrueszcoS2Z1 J2Wc9ff034WCjeE1H+un9zsF/fcUvJyXgbLlrh4Y= Received: (qmail 99073 invoked by alias); 18 Sep 2017 18:26:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 99064 invoked by uid 89); 18 Sep 2017 18:26:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*be, HTo:D*be, HTo:D*gmx.de, HX-ClientProxiedBy:sk:MWHPR12 X-HELO: NAM01-BY2-obe.outbound.protection.outlook.com Received: from mail-by2nam01on0087.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) (104.47.34.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Sep 2017 18:26:36 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Steve.Ellcey@cavium.com; Received: from sellcey-dt.caveonetworks.com (50.233.148.156) by MWHPR07MB3549.namprd07.prod.outlook.com (10.164.192.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Mon, 18 Sep 2017 18:26:33 +0000 Message-ID: <1505759191.2286.72.camel@cavium.com> Subject: [PATCH][aarch64] Fix error calls in aarch64 code so they can be tranlated From: Steve Ellcey Reply-To: sellcey@cavium.com To: gcc-patches , roland.illig@gmx.de, fmarchal@perso.be Date: Mon, 18 Sep 2017 11:26:31 -0700 Mime-Version: 1.0 X-ClientProxiedBy: MWHPR12CA0069.namprd12.prod.outlook.com (10.175.47.159) To MWHPR07MB3549.namprd07.prod.outlook.com (10.164.192.138) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be9da88b-6240-4afb-6206-08d4fec2ca52 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(49563074)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:MWHPR07MB3549; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3549; 3:f0Qcu5oxafgu3qYSohtucvdTSxPsOwsWur+k/2KCe+x2vZMmujOwETLKRetS4AmKo2j2m+f7EMsy7kfY8oOxr1FzsUY0MdzFzz7hsTdCJPNMiVlzVoNPR7wDQlFlEmht/9j/JlYWRa3KIgxn4lZ6Pr1TWTXqoo0lNSQ2tJzrntzmJ6OBGe6eFna8TUjpBgWT6osFPeSr/s9f0biG7rSvUV8w4IfXtMr+IHSpdaz5/jQzwpFeftPJOhOmzGKvJnTA; 25:7iNnlZUNLYg8YIT9M0e7lTqm90TkYRM0vztzAYZ0JK5vPAz5Ls+yzTIVjbBt+CQsoxsdRWHtFaZUTuN8Mn70Qp47OFQXFbSmMdi1XN8OxXBfv317rlokW7vTI4q3dUEk6xFwLjl1Jzg43W8zTahLgBO9FC/aKS0L3LuWrM6Z5jjTT3bk54hskq+pHUHc/eqDig7WuTJjC7xUXUTn3Luwqk0nZTazmooM8WDik6rSqVhOqjAYHR1wLIwdQNlrl/co3tgnMsF/mJlWmpv28CcUui8sCX1w53vfmYGLUnrGIPXFC0xo8cfYnJQQp2TDC6gwKBg3CLX7V0t0HwrIOlxBQA==; 31:HjWc/Gy3CQEEzrjWSjglABW0lj0mifo5WX0UbIeHDJ+k7Cb5LjaR8svtj3B+xyjyFoRTRJndGEUDikrJx72PGpXh7j/bQ5cFmrNOR8JAVD0z/CosooHBfkgXOvq2NBH641+2ExCcCGuHhrJIAKNfflgDWjo8M9rJwjPdHjb5zHWcsjNe7dO0FkSDowH50++kikk5lbcnfoQtDlhjdbDrzu+FovGIq3nZVg3Gv/hSi9Y= X-MS-TrafficTypeDiagnostic: MWHPR07MB3549: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3549; 20:/GB2ukfD/HTiKiFfDvrT61vvMYuwKxPxCf3WkS9vU336K8qE4JJd/rsIuPRJN165xfgLqU1N9i7zxOIkCeTXbhxOwTMfui/akSafoKqNzr4KBWTUfgTfYhuS9DOvfL40z1u8jvXukaEQNFQHXuXpxFOgtCJ0YyiFuRfWR5XM3EiKWuk7mEX7DIKDYKx7oSvp/ZkqBGfV1GD/UhfLY/aI24eu6/nz2nzLeUZkwnmwNCcqCR6U+HqK6GqxRhCedsuk6hhptINmTb84UfqWcFO6pKRd9zpgpnAn1jzqt6kCeQlj5qXV/Sh3Mbw7YhLT2GY/XFnmhz/eidR7Aa8AwnkiVKgoAjwNwy88By/N3K+WnL342kYj8+tglNcNxkqK1wK0gItVybrcr53dnFGFDbvI7HcsvhZFLzQ4pvwBykZLFWqyoDqgR5d4FMvDhi5SLY1Mo2LgsrmAAW6gvAdsDy+t7sqCu6aXoEXdSK9GSJZSNt8fueRz0yKY+1WZnTv5LE+9; 4:jyG341BMz+RefguKSJ6sAV4CXP1tLMjHoMgvGz8seZylz4vFBfUpQt98PeyaOlvlT3+WDn8+4/LzGUH4na5p93xFes3TDXAVmzZqUkJMhw1dCRjvGKx2YqwGQOnslZPt+SN1G+KB2AbW6cU5KRUNorN6jg8CjK5hgsWpcAl1ESXL5sDdnszvXt3KsB+6RYc0SASKBp/fT3UbJHlfAZhrSZBLj6oxdJp3ThbCdcMb7VAc09nW9pWsCHCqGrXI0kv0 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3549; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3549; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(346002)(376002)(199003)(377424004)(189002)(5660300001)(69596002)(101416001)(50986999)(8666007)(2906002)(189998001)(5890100001)(106356001)(568964002)(3450700001)(50226002)(103116003)(25786009)(105586002)(8936002)(43066003)(36756003)(53416004)(316002)(305945005)(7736002)(16586007)(97736004)(66066001)(33646002)(4610100001)(6506006)(6486002)(72206003)(16526017)(6512007)(6116002)(81156014)(3846002)(84326002)(512874002)(81166006)(8676002)(68736007)(478600001)(2476003)(53936002)(99106002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3549; H:sellcey-dt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3549; 23:waqqtoqSkogIuyotYk1B/KGMYwPXaNkIdtceQhXi1DGmOK4vycZI5eCagMiAiGRKAR2/guNuCs7XYjxN5ZGVqG/dFSYPG9Ic6tMLfPGKTOc9l5tTsstBgbn///gWpu1+grsK10pIM9ooxR9Zojn8ul4hF5HE0pQOQeMCBrktLvqaAbsRLhERB0zHF8dAcbFK7nCEcpaYi4Xoh/VNCprYbUcv7BwCz3RY9jmhGfc8ptGPDHbLqT/KPOzYGSDb5U0xd/7g6PAy2Mh6nMNOH9lPed7yfJse30ff3ZAzNjMKNWvqsw26lVLsLmD6CM4pkSF4Fyq+L2zu0uuSBL2GEm3I2m2u0kl1c9vJeG2w/enpbdydwTQVX98YM26dD90weHABJv5ywukGoBWM7K3WTrumCuGrVBrywz26CaxTqCAgEcwAIaQBpqm20A7lkFW/Qk525vRZS6edgFV9Triwd8F9J2QUaKHFTTGw0nXr4zeTcIY6iciKHy498r2q3TPmRilsXsjzXH4zPraoEaM7Jiipz+cycdbNTJWj7apABRPoBPkRo+Lc+wbrtjBxX4i1CQYDuhj51KJUwsgHXDuuXVwMhEhqVw5o/hO8ZW7YUVzASo9F2E077/+3yXbT4a6D2LTmmC3u730evTCfZzzVqGINWd9+JGWgKTu+S53ne/LxaBCmdQ8ZP2yCFb1/MU6of2i+E9aMjTegjx0gMdc3amsH8ygAA1znbHoOMCI8sfwjwBQHuLFSkt2Psu3ZsWKvuWoyUE4xj0Nrh4tfl1vcKeq5+G8UhjU7BxjMsYzQGQzaZHgoms2dG/Uf8os2og6fssMlJC1QUHZhPH6E45Ijd+VR1YfyLfG3ycN9zx3kVhurdwgIwiTCbbeifGteSmMBZu66pPKinXP8f5MuZTvoAGJ2FPNbenx5Wn/a65FMuJtlIv6z07AVVSFj+cp5Yrim/4/c9ebsMTvXHTV/4AZMJY4e+20VeOCWOpsvQt+mUitTIGqz242U/ucFHThx0GlLTOTPZiJzDL/L8oQx//SI6OfyES2YD5skCOYntpcrvRmzG+MxHrEO7Av1OadKGByfua0fcGrgqjG4Nu7I3CLzlfRxheqwD4TaKVdv0sw8z7+19g5zP57SWgnVwjJKnGfnL/L9SeanNOhBtHsZtjRZcM7zomwohUlrqVd5P3u6TvgwgExLsXwlVO//54QpQUCzTKvTzCtbY0G/ds/B3eHu0zWUUQUsUV64kW61Goo1xwGoR8/mZYjrFzvqPVp5Odgzzynu X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3549; 6:iNnpffnH/VFutOZlz0iljM/hLv7oHcUak7i9SCIDsdHrTYd8H8qjlMdnYYGa2cObTCvJXxFTrCF7H8VBFd+yzXi9OW5YynPqupM7RCpcbBy7UUAAsdWXaBmS+Aq/MLa8hEz7lr22kTRMpMpRgJIYgofMcPC4AUygnMmcJB24riKWb7VVIbdpkLWjXZAcVkd+5e+cFNPUrMAxRfMon7QIjsZwvWU0HXnpWesas9kgCw+pCk9umj56m/1nS+Fp1Hu4ccU5ka5fhqdMA5glSc3PytAKoJQGEIqdwytiK+HobzK3pKpV+JSMN+Ayv73DfgSAN56kEFP+Cc17alprK1evmg==; 5:uLiPnysuLbM0Ah6sZ4ubmR/xU7hjZFsjykWmsKQ+NrvtJjSfFsPCIpqguGfVd6pXQuKoKvJ1qcP4uJH4REUK8m6gwomJbFEfO4K6b1PD4hv3DJA9gdWDe2nPfiwEuHv1LKByKtb0Dmugs55asQAzzg==; 24:0Yjv+f9iImTx+N+4OL0uOrwyp+BFcHbLvNgwmYRncXvu+myk6ZwoMf/PQ7CkUbBzwpciGtrkfgVgjRY+DC+fjPsoSwWKG6FW4AYHXOIjV5s=; 7:2PNcfspG4m6HFHrgdz9TG+B4kXqyeJGEMZ+p0BmwD6bUwDIWbGJkfeauHF1joMDBWtb9+sgRNyZ8Nhsj3ln+2hklmVwGb016cLTxWVSRNsSeupJpP9FkcZ7Ngs6mQoF/YG9/KK2/AFa/LJo2/4EEcAibaHue0pVZvEDFanDa8GLLuDXFJUpKy5GgGweffirybn4CST0MFH219DOxpKqsC62NWAdKOSA2jr/k+pL7XLo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 18:26:33.6027 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3549 This patch is for PR target/79868, where some aarch64 diagnostics are said to be not translatable due to how they are implemented.  See the bug report for more details on why the current setup of passing the string 'pragma' or 'attribute' doesn't work. This patch fixes it, unfortunately by increasing the number of calls we have to 'error' (16 calls become 32 calls), but that seems to be the most straight forward way to get translatable strings. This patch is an update to the one I originally attached to the bug report and I have fixed the issue that Frederic Marchal found in my original patch. OK to checkin? Steve Ellcey sellcey@cavium.com 2017-09-18  Steve Ellcey   PR target/79868 * config/aarch64/aarch64-c.c (aarch64_pragma_target_parse): Change argument type on aarch64_process_target_attr call. * config/aarch64/aarch64-protos.h (aarch64_process_target_attr): Change argument type. * config/aarch64/aarch64.c (aarch64_attribute_info): Change field type. (aarch64_handle_attr_arch): Change argument type, use boolean argument to make different error calls. (aarch64_handle_attr_cpu): Ditto. (aarch64_handle_attr_tune): Ditto. (aarch64_handle_attr_isa_flags): Ditto. (aarch64_process_one_target_attr): Ditto. (aarch64_process_target_attr): Ditto. (aarch64_option_valid_attribute_p): Change argument type on aarch64_process_target_attr call. diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c index 177e638..c9945db 100644 --- a/gcc/config/aarch64/aarch64-c.c +++ b/gcc/config/aarch64/aarch64-c.c @@ -165,7 +165,7 @@ aarch64_pragma_target_parse (tree args, tree pop_target) information that it specifies. */ if (args) { - if (!aarch64_process_target_attr (args, "pragma")) + if (!aarch64_process_target_attr (args, true)) return false; aarch64_override_options_internal (&global_options); diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index e67c2ed..4323e9e 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -445,7 +445,7 @@ bool aarch64_gen_adjusted_ldpstp (rtx *, bool, scalar_mode, RTX_CODE); void aarch64_init_builtins (void); -bool aarch64_process_target_attr (tree, const char*); +bool aarch64_process_target_attr (tree, bool); void aarch64_override_options_internal (struct gcc_options *); rtx aarch64_expand_builtin (tree exp, diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 1c14008..054b1d2 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -9554,7 +9554,7 @@ struct aarch64_attribute_info const char *name; enum aarch64_attr_opt_type attr_type; bool allow_neg; - bool (*handler) (const char *, const char *); + bool (*handler) (const char *, bool); enum opt_code opt_num; }; @@ -9562,7 +9562,7 @@ struct aarch64_attribute_info PRAGMA_OR_ATTR is used in potential error messages. */ static bool -aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) +aarch64_handle_attr_arch (const char *str, bool is_pragma) { const struct processor *tmp_arch = NULL; enum aarch64_parse_opt_result parse_res @@ -9579,15 +9579,24 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) switch (parse_res) { case AARCH64_PARSE_MISSING_ARG: - error ("missing architecture name in 'arch' target %s", pragma_or_attr); + if (is_pragma) + error ("missing architecture name in 'arch' target pragma"); + else + error ("missing architecture name in 'arch' target attribute"); break; case AARCH64_PARSE_INVALID_ARG: - error ("unknown value %qs for 'arch' target %s", str, pragma_or_attr); + if (is_pragma) + error ("unknown value %qs for 'arch' target pragma", str); + else + error ("unknown value %qs for 'arch' target attribute", str); aarch64_print_hint_for_arch (str); break; case AARCH64_PARSE_INVALID_FEATURE: - error ("invalid feature modifier %qs for 'arch' target %s", - str, pragma_or_attr); + if (is_pragma) + error ("invalid feature modifier %qs for 'arch' target pragma", str); + else + error ("invalid feature modifier %qs for 'arch' target attribute", + str); break; default: gcc_unreachable (); @@ -9600,7 +9609,7 @@ aarch64_handle_attr_arch (const char *str, const char *pragma_or_attr) PRAGMA_OR_ATTR is used in potential error messages. */ static bool -aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) +aarch64_handle_attr_cpu (const char *str, bool is_pragma) { const struct processor *tmp_cpu = NULL; enum aarch64_parse_opt_result parse_res @@ -9620,15 +9629,24 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) switch (parse_res) { case AARCH64_PARSE_MISSING_ARG: - error ("missing cpu name in 'cpu' target %s", pragma_or_attr); + if (is_pragma) + error ("missing cpu name in 'cpu' target pragma"); + else + error ("missing cpu name in 'cpu' target attribute"); break; case AARCH64_PARSE_INVALID_ARG: - error ("unknown value %qs for 'cpu' target %s", str, pragma_or_attr); + if (is_pragma) + error ("unknown value %qs for 'cpu' target pragma", str); + else + error ("unknown value %qs for 'cpu' target attribute", str); aarch64_print_hint_for_core (str); break; case AARCH64_PARSE_INVALID_FEATURE: - error ("invalid feature modifier %qs for 'cpu' target %s", - str, pragma_or_attr); + if (is_pragma) + error ("invalid feature modifier %qs for 'cpu' target pragma", str); + else + error ("invalid feature modifier %qs for 'cpu' target attribute", + str); break; default: gcc_unreachable (); @@ -9641,7 +9659,7 @@ aarch64_handle_attr_cpu (const char *str, const char *pragma_or_attr) PRAGMA_OR_ATTR is used in potential error messages. */ static bool -aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) +aarch64_handle_attr_tune (const char *str, bool is_pragma) { const struct processor *tmp_tune = NULL; enum aarch64_parse_opt_result parse_res @@ -9658,7 +9676,10 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) switch (parse_res) { case AARCH64_PARSE_INVALID_ARG: - error ("unknown value %qs for 'tune' target %s", str, pragma_or_attr); + if (is_pragma) + error ("unknown value %qs for 'tune' target pragma", str); + else + error ("unknown value %qs for 'tune' target attribute", str); aarch64_print_hint_for_core (str); break; default: @@ -9675,7 +9696,7 @@ aarch64_handle_attr_tune (const char *str, const char *pragma_or_attr) PRAGMA_OR_ATTR is used in potential error messages. */ static bool -aarch64_handle_attr_isa_flags (char *str, const char *pragma_or_attr) +aarch64_handle_attr_isa_flags (char *str, bool is_pragma) { enum aarch64_parse_opt_result parse_res; unsigned long isa_flags = aarch64_isa_flags; @@ -9699,13 +9720,17 @@ aarch64_handle_attr_isa_flags (char *str, const char *pragma_or_attr) switch (parse_res) { case AARCH64_PARSE_MISSING_ARG: - error ("missing feature modifier in target %s %qs", - pragma_or_attr, str); + if (is_pragma) + error ("missing feature modifier in target pragma %qs", str); + else + error ("missing feature modifier in target attribute %qs", str); break; case AARCH64_PARSE_INVALID_FEATURE: - error ("invalid feature modifier in target %s %qs", - pragma_or_attr, str); + if (is_pragma) + error ("invalid feature modifier in target pragma %qs", str); + else + error ("invalid feature modifier in target attribute %qs", str); break; default: @@ -9748,7 +9773,7 @@ static const struct aarch64_attribute_info aarch64_attributes[] = we're processing a target attribute or pragma. */ static bool -aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) +aarch64_process_one_target_attr (char *arg_str, bool is_pragma) { bool invert = false; @@ -9756,7 +9781,10 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) if (len == 0) { - error ("malformed target %s", pragma_or_attr); + if (is_pragma) + error ("malformed target pragma"); + else + error ("malformed target attribute"); return false; } @@ -9772,7 +9800,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) through the machinery for the rest of the target attributes in this function. */ if (*str_to_check == '+') - return aarch64_handle_attr_isa_flags (str_to_check, pragma_or_attr); + return aarch64_handle_attr_isa_flags (str_to_check, is_pragma); if (len > 3 && strncmp (str_to_check, "no-", 3) == 0) { @@ -9804,8 +9832,12 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) if (attr_need_arg_p ^ (arg != NULL)) { - error ("target %s %qs does not accept an argument", - pragma_or_attr, str_to_check); + if (is_pragma) + error ("target pragma %qs does not accept an argument", + str_to_check); + else + error ("target attribute %qs does not accept an argument", + str_to_check); return false; } @@ -9813,8 +9845,12 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) then we can't match. */ if (invert && !p_attr->allow_neg) { - error ("target %s %qs does not allow a negated form", - pragma_or_attr, str_to_check); + if (is_pragma) + error ("target pragma %qs does not allow a negated form", + str_to_check); + else + error ("target attribute %qs does not allow a negated form", + str_to_check); return false; } @@ -9824,7 +9860,7 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) For example, cpu=, arch=, tune=. */ case aarch64_attr_custom: gcc_assert (p_attr->handler); - if (!p_attr->handler (arg, pragma_or_attr)) + if (!p_attr->handler (arg, is_pragma)) return false; break; @@ -9868,8 +9904,12 @@ aarch64_process_one_target_attr (char *arg_str, const char* pragma_or_attr) } else { - error ("target %s %s=%s is not valid", - pragma_or_attr, str_to_check, arg); + if (is_pragma) + error ("target pragma %s=%s is not valid", + str_to_check, arg); + else + error ("target attribute %s=%s is not valid", + str_to_check, arg); } break; } @@ -9908,7 +9948,7 @@ num_occurences_in_str (char c, char *str) a target attribute or a target pragma. */ bool -aarch64_process_target_attr (tree args, const char* pragma_or_attr) +aarch64_process_target_attr (tree args, bool is_pragma) { if (TREE_CODE (args) == TREE_LIST) { @@ -9917,7 +9957,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) tree head = TREE_VALUE (args); if (head) { - if (!aarch64_process_target_attr (head, pragma_or_attr)) + if (!aarch64_process_target_attr (head, is_pragma)) return false; } args = TREE_CHAIN (args); @@ -9938,7 +9978,10 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) if (len == 0) { - error ("malformed target %s value", pragma_or_attr); + if (is_pragma) + error ("malformed target pragma value"); + else + error ("malformed target attribute value"); return false; } @@ -9953,9 +9996,12 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) while (token) { num_attrs++; - if (!aarch64_process_one_target_attr (token, pragma_or_attr)) + if (!aarch64_process_one_target_attr (token, is_pragma)) { - error ("target %s %qs is invalid", pragma_or_attr, token); + if (is_pragma) + error ("target pragma %qs is invalid", token); + else + error ("target attribute %qs is invalid", token); return false; } @@ -9964,8 +10010,11 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr) if (num_attrs != num_commas + 1) { - error ("malformed target %s list %qs", - pragma_or_attr, TREE_STRING_POINTER (args)); + if (is_pragma) + error ("malformed target pragma list %qs", TREE_STRING_POINTER (args)); + else + error ("malformed target attribute list %qs", + TREE_STRING_POINTER (args)); return false; } @@ -10025,7 +10074,7 @@ aarch64_option_valid_attribute_p (tree fndecl, tree, tree args, int) TREE_TARGET_OPTION (target_option_current_node)); - ret = aarch64_process_target_attr (args, "attribute"); + ret = aarch64_process_target_attr (args, false); /* Set up any additional state. */ if (ret)