From patchwork Mon Oct 2 08:02:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 147206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1263767vqb; Mon, 2 Oct 2023 01:03:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlioDas4rl/czIqjKeevsSGmKnzwmTsKVJ3YnnflMPC5AwHTk/1orTWWpRj24iA9uI85Yb X-Received: by 2002:a17:906:5393:b0:9a1:f73b:90ce with SMTP id g19-20020a170906539300b009a1f73b90cemr9842865ejo.54.1696233805272; Mon, 02 Oct 2023 01:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696233805; cv=none; d=google.com; s=arc-20160816; b=1I25fsMRKCIs4XySVEo8/bMZmo5BSLuhyqgt9IQGTzGtFQHkU4EtV1uq0JXaZ76mY8 quRft+XHUL7eZSsUQgwm3T/GERN7Qxgtjy/7iw92GWSbMqNJ/9bQQC8BXa9YY1Vh+f3K knPDfB5SaqONtGDv+FYzP3yGuODVBgoVh0Gkty1IGp80M0PzMCJH//gIVXscyS94sK/7 qnM+y0HvaVJZ2FQtndjP4fG3gBm79g2e4ma7Xgso5zo1lIUOj1LgqPsU1JVaLuaitP+2 ug34nssESaUTDnmfDJzIcNIIaKFlCdA++1f0RVq6dZWxiHzurrfvkfdjPQVOWUz/Movo 9jZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=MxgzLIX+WcBd6RU1OFmiTEvdwOc5IthXphJQSUz0Bb4=; fh=+dsmj94Ywr1X3f8PRs+LbmcFtYR+ej3gMEE5Slh4IWE=; b=gzqbegCidJbED25c2N3VK4Zv7B1QaiK+iYn+bRK4OcBLQLucma4Nh9FNUFTDtG+5qj +mVBvAkCcKLrodudWWM0aq9WbfiPjerJSxlMyeyTn9syrEUFjnpgJIwrAg978MA6p9Mp 880BHk3e0ACGlOHaAt0p115mpNaNxJVPiSVwaJQaQzLB4ro7TbYKjgeYEm4z2l8AJ+9G CYf3wCPzZ59l17KQ0pFVTZgtx21Dy5WBpUgZisM20TP2JLiJY9hBH+9fREmOnhGTDdju VyMhDqDlmFhfbBdYe58N00heY2J3wyH3vVGRlktYQ0i+jfyCSO8kjwvqnUO7tTYqRDbz vHyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=IqpGSGnV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k17-20020a1709063e1100b0099b4222f51fsi19866694eji.266.2023.10.02.01.03.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 01:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=IqpGSGnV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E4D5385770B for ; Mon, 2 Oct 2023 08:03:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 614893858D35 for ; Mon, 2 Oct 2023 08:02:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 614893858D35 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-351250be257so47045275ab.0 for ; Mon, 02 Oct 2023 01:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1696233771; x=1696838571; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MxgzLIX+WcBd6RU1OFmiTEvdwOc5IthXphJQSUz0Bb4=; b=IqpGSGnVdiBGUFIRFbsww183npTDIq+G7QY4fRX7c51hfmd1EPZIb3XDX1g0FPlCJR 2nvEmqaFrKuPCaQy0JD8exRRoyqs99EYbgKy9DgwnWxhmHterrgxRUPmNspbsDrsxx4S ENUEMClyXW4xWLEBhJAI3IFuhkmAqzs9QA5+ebSwaLdHC2R105W7lhr1nDyALvQbeQ8F /iihYx5L9m/8c8MNVdrPdPviHtBTJEWoGWGTDSx6vj68x4O52HJCukqcThUmLHey/hVR OGN8SRxQZeiUj9SGOxI0KDPHopvFwfEvHAyyi42IITr1cbB9FhlFeNCjGkRvqOo7wEe3 UizA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696233771; x=1696838571; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MxgzLIX+WcBd6RU1OFmiTEvdwOc5IthXphJQSUz0Bb4=; b=wJhXefKwR9jQ/JaSoGaaU8FfrqtrXwVa6SPZj1JSzK4K0h82JgAv/wcEeeT/Y26mSG vS9OZTx741O+xrO+/xn07ZFKCv8H3Q4KMqXMBlg6FaO9H/K1EkqKRcmfqldBmEL1YSsl 2E5NThC4PmAaTzKUv17dZEqJklpjdS7zcXyCFTbibdtR8EYbVOLj+qzgHGsAUdCdN4+F MCeRY5Cps+j8lxovYN5bkjgIVCXjt3ecLFXjoNbDMnio8aTWEJ9KooG198bJDTw2i4QV rdU8Jbmevdo1Si8HWgBdbJwYE4q2adFQH1D4PFydnoSBstLIFDS2fT7WutSB7VH0vhyt YO8Q== X-Gm-Message-State: AOJu0YwI+PCrx7c2PsZdmOyo0C/Q4pc3dlJb99P1p13ybv31eoaVuqOn ow6R6BanN7lBqJ+8Rb6zaqOI+Q== X-Received: by 2002:a6b:dc10:0:b0:794:e96f:b87d with SMTP id s16-20020a6bdc10000000b00794e96fb87dmr10813669ioc.0.1696233771356; Mon, 02 Oct 2023 01:02:51 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id v14-20020a17090ad58e00b002777ba600fdsm5642431pju.25.2023.10.02.01.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 01:02:50 -0700 (PDT) From: Kito Cheng To: gerald@pfeifer.com, jbglaw@lug-owl.de, gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jeffreyalaw@gmail.com, wangfeng@eswincomputing.com Cc: Kito Cheng Subject: [PATCH] options: Prevent multidimensional arrays Date: Mon, 2 Oct 2023 16:02:44 +0800 Message-Id: <20231002080244.105205-1-kito.cheng@sifive.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778630058140984123 X-GMAIL-MSGID: 1778630058140984123 Multidimensional arrary is gawk extension, and we accidentally introduced that in recent commit[1]. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e4a4b8e983bac865eb435b11798e38d633b98942 gcc/ChangeLog: * opt-read.awk: Drop multidimensional arrays. * opth-gen.awk: Ditto. --- gcc/opt-read.awk | 4 ++-- gcc/opth-gen.awk | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/opt-read.awk b/gcc/opt-read.awk index fcf92853957..f74d8478f72 100644 --- a/gcc/opt-read.awk +++ b/gcc/opt-read.awk @@ -123,7 +123,7 @@ BEGIN { } else { target_var = opt_args("Var", $0) - if (target_var) + if (target_var) { target_var = opt_args("Var", $1) var_index = find_index(target_var, target_vars, n_target_vars) @@ -131,7 +131,7 @@ BEGIN { { target_vars[n_target_vars++] = target_var } - other_masks[var_index][n_other_mask[var_index]++] = name + other_masks[var_index "," n_other_mask[var_index]++] = name } else { diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 70ca3d37719..c4398be2f3a 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -412,9 +412,9 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define MASK_" other_masks[i][j] " (1U << " other_masknum[i][""]++ ")" + print "#define MASK_" other_masks[i "," j] " (1U << " other_masknum[i]++ ")" } - if (other_masknum[i][""] > 32) + if (other_masknum[i] > 32) print "#error too many target masks for" extra_target_vars[i] } @@ -437,8 +437,8 @@ for (i = 0; i < n_target_vars; i++) continue for (j = 0; j < n_other_mask[i]; j++) { - print "#define TARGET_" other_masks[i][j] \ - " ((" target_vars[i] " & MASK_" other_masks[i][j] ") != 0)" + print "#define TARGET_" other_masks[i "," j] \ + " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)" } } print ""