Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jeg8h-00043D-Qy for mharc-grub-devel@gnu.org; Fri, 29 May 2020 10:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeg8g-00040r-B4 for grub-devel@gnu.org; Fri, 29 May 2020 10:37:38 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:46373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jeg8f-00031b-6Z for grub-devel@gnu.org; Fri, 29 May 2020 10:37:37 -0400 Received: by mail-pl1-x643.google.com with SMTP id i17so1215669pli.13 for ; Fri, 29 May 2020 07:37:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=PdmLwUMJjWZvrO1s2siR8zhlV8kFA15XoWhQPDy0ELI=; b=JYoHBXOiKWlxEJYtrO6Cuqe7r4nV5Z1998Ux3xRe+tjPcWZwD6+9A2sVat5nFuy5EO berxT8EJpLqqphNRQPU8xGpWUP8UvCm/fbdez/QnBSz7Tj1oQ/UOoHauIcD8b97r/RtA oU2Yy8Hss+820MnW9nWeJiLSLvo6N4yOtlPnI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=PdmLwUMJjWZvrO1s2siR8zhlV8kFA15XoWhQPDy0ELI=; b=bpwiV1EKjMdCb4D7xmiZJneyztvY52LUsSYwmPYh3+vz/CvcvvoTXNPIFfKIxuCEHW nK2ioX/gjW/Vgb/AhMmFvI85grCEMEFPi1KZO+ljXbdJto1x2jJLKufbvrf6WPxFbOht 7RQFIyc5upbGjcd3vdMrjpM6Tg5Qdksv7PZK0SkQAnXfD5nF1g/lQ95vz2Ayj4cwqvbR NMWai5+HQ54sO3WTquZjW44dKsPumFtC4BeDahBR8y2UvQYvHFxL+B9wSPx9268rYJ+a fsJjm8mdlxXWa0VMmye9ro2CU1WxNkppw6YfND5ThoIYwbeB6b3VuYzyKl7kYJvutdx/ 2ZUw== X-Gm-Message-State: AOAM531aVDHfTUdnV4dsd6d60TnNwJOTle3FAngN8X2REvyPY2/iSa84 jranDGnmE77MwDGzdY9VgdBbLA== X-Google-Smtp-Source: ABdhPJzhclmz1yRqWVnbHYGuumMsTcxnw0FZg0sxvvi4CHgvuNxO5QQdnmM0NQYsqA+8Y8XbvCtpYA== X-Received: by 2002:a17:90b:1002:: with SMTP id gm2mr9904524pjb.197.1590763055386; Fri, 29 May 2020 07:37:35 -0700 (PDT) Received: from localhost (2001-44b8-111e-5c00-015d-2cb8-7187-5014.static.ipv6.internode.on.net. [2001:44b8:111e:5c00:15d:2cb8:7187:5014]) by smtp.gmail.com with ESMTPSA id s1sm7772636pjp.27.2020.05.29.07.37.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2020 07:37:34 -0700 (PDT) From: Daniel Axtens To: Patrick Steinhardt Cc: Daniel Kiper , grub-devel@gnu.org, eschwartz@archlinux.org, floppym@gentoo.org, glaubitz@physik.fu-berlin.de, javierm@redhat.com, leif@nuviainc.com, olaf@aepfle.de, phcoder@gmail.com, pjones@redhat.com Subject: Re: [PATCH] json: Remove invalid typedef redefinition In-Reply-To: <8082aa62a53ff1f56c7edefbc8455e8b295bb76c.1590571037.git.ps@pks.im> References: <87v9kyq7tj.fsf@dja-thinkpad.axtens.net> <8082aa62a53ff1f56c7edefbc8455e8b295bb76c.1590571037.git.ps@pks.im> Date: Sat, 30 May 2020 00:37:31 +1000 Message-ID: <87zh9qzu1g.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=dja@axtens.net; helo=mail-pl1-x643.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 14:37:38 -0000 Hi Patrick, > The C standard does not allow for typedef redefinitions, even if they > map to the same underlying type. In order to avoid including the > "jsmn.h" in "json.h" and thus exposing jsmn's internals, we have exactly > such a forward-declaring typedef in "json.h". If enforcing the GNU99 C > standard, clang may generate a warning about this non-standard > construct. > > Fix the issue by using a simple `struct jsmntok` forward declaration > instead of using a typedef. > > Signed-off-by: Patrick Steinhardt Tested-by: Daniel Axtens # clang build test for emu target only With this patch, clang can compile master again. Thanks Patrick! Regards, Daniel > --- > > Sorry for the late response, didn't notice at first that this directly > impacts code I wrote. I don't have Clang available on my computer and > GCC seems to lack the equivalent option for this, so I wasn't able to > reproduce the warning. Below patch should fix the issue, though, as we > simply avoid using a typedef for the forward declaration. > > grub-core/lib/json/json.h | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/grub-core/lib/json/json.h b/grub-core/lib/json/json.h > index d9f99454d..2e2b0bd07 100644 > --- a/grub-core/lib/json/json.h > +++ b/grub-core/lib/json/json.h > @@ -36,13 +36,14 @@ enum grub_json_type > }; > typedef enum grub_json_type grub_json_type_t; > > -typedef struct jsmntok jsmntok_t; > +/* Forward-declaration to avoid including "jsmn.h" */ > +struct jsmntok; > > struct grub_json > { > - jsmntok_t *tokens; > - char *string; > - grub_size_t idx; > + struct jsmntok *tokens; > + char *string; > + grub_size_t idx; > }; > typedef struct grub_json grub_json_t; > > -- > 2.26.2