From patchwork Wed Apr 10 10:25:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Thomas X-Patchwork-Id: 1921896 X-Patchwork-Delegate: lynxis@fe80.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=nkDZwjMY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VDzY75cW2z1yYM for ; Wed, 10 Apr 2024 20:27:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KKu0TDzsHu6SjjNz7op4+WSZOZRWc+c3ZquRTJNatjI=; b=nkDZwjMYe32Ipa jW2TluBl0/vArlSWaVWJz3BNG1l5uS5cNAZ92pAHkWJlGO/Pd6Ay9RmcwUXcINMEpid2dynsYgk4W WjAHRlNY4pJnBi4nJU8lgAApanXIK1LQwAOeVglkqJ5HncxxYoYXMPNDWGXBMxikovIoEzDEZ61X2 Y9MwmqZsJxMtAi/42tLs+NEFOsoiZfzph4IBLVk40YukVTksooT3ZWjXGOP91YrcMRS5C8ICjUOB6 NOx14NG7B/PxeTbxQTRQLtuIOAfytvIeCV0qXHf5HXSovCakG/6iNipTtVa941j0N++OoxXBa2MiP EPFX/Q2xg2xBDMZXyvug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruV9K-00000006NUe-1OCD; Wed, 10 Apr 2024 10:25:50 +0000 Received: from smtp6-g21.free.fr ([212.27.42.6]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruV9G-00000006NT8-0cEk for openwrt-devel@lists.openwrt.org; Wed, 10 Apr 2024 10:25:48 +0000 Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:aa1:d2f0:f6b3:db6:44c:eeef]) (Authenticated sender: isaias57@free.fr) by smtp6-g21.free.fr (Postfix) with ESMTPSA id 1B2EC78034E; Wed, 10 Apr 2024 12:25:39 +0200 (CEST) From: Jean Thomas To: openwrt-devel@lists.openwrt.org Cc: jean.thomas@wifirst.fr Subject: [PATCH 1/5] uqmi: support C reserved keywords in upstream JSON files Date: Wed, 10 Apr 2024 12:25:05 +0200 Message-Id: <20240410102509.3936469-1-jean.thomas@wifirst.fr> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_032546_400510_E66456E1 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.7 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add a dummy prefix in case a name in the upstream JSON files is a C reserved keyword. This is the case with the "Register" element of the new "Configure Profile Event List" message. Signed-off-by: Jean Thomas --- data/gen-common.pm | 52 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) Content analysis details: (0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.27.42.6 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.27.42.6 listed in wl.mailspike.net] 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Add a dummy prefix in case a name in the upstream JSON files is a C reserved keyword. This is the case with the "Register" element of the new "Configure Profile Event List" message. Signed-off-by: Jean Thomas --- data/gen-common.pm | 52 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/data/gen-common.pm b/data/gen-common.pm index 278afce..31d43a0 100644 --- a/data/gen-common.pm +++ b/data/gen-common.pm @@ -19,6 +19,54 @@ our %tlv_types = ( ); our %common_ref = (); +my @c_reserved_keywords = ( + "alignas", + "alignof", + "auto", + "bool", + "break", + "case", + "char", + "const", + "constexpr", + "continue", + "default", + "do", + "double", + "else", + "enum", + "extern", + "false", + "float", + "for", + "goto", + "if", + "inline", + "int", + "long", + "nullptr", + "register", + "restrict", + "return", + "short", + "signed", + "sizeof", + "static", + "static_assert", + "struct", + "switch", + "thread_local", + "true", + "typedef", + "typeof", + "typeof_unqual", + "union", + "unsigned", + "void", + "volatile", + "while" +); + $prefix eq 'ctl_' and $ctl = 1; sub get_json() { @@ -33,7 +81,9 @@ sub gen_cname($) { $name =~ s/[^a-zA-Z0-9_]/_/g; $name = "_${name}" if $name =~ /^\d/; - return lc($name); + $name = lc($name); + $name = "_${name}" if (grep {$_ eq $name} @c_reserved_keywords); + return $name; } sub gen_has_types($) {