From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id BA6A73858C41 for ; Tue, 27 Jun 2023 07:21:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA6A73858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b69f71a7easo30584301fa.1 for ; Tue, 27 Jun 2023 00:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687850468; x=1690442468; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MFRRXKFf+0w26EofWMAuGfN90Vrj6O/XJgBSSHzUhq4=; b=Mf2bLqGT5V8+xnE+iSbomUazo8apisnmwFqbkPS8ms6C1utL10QTp5Rz4rbW3dG0Zq NrHgbONwMBCgWolOYI3AxGvnywSCybz+ki/Wr1V+uXu/K13Fe1CHYZUD2OmvEAEVd40H bwi70aSCV+vv9o1x++jt6s6a4S1Ay56pbo7sQPjpwakawmgFoWtrCAAQ1jup0rj0Oxbi +zWPlsePAVVGZ0hR3IeXhUPwjOKKAPq8nsdSkk6+cBUDzlgCTk4OcmC/YiA6qv/+ieR6 uCaWBba9giTf2nq3n3kYhFFYV5f1RGycrP4FJ8k1BfjD/5BjBqI3b2D587grMQfe4iQk 4Xnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687850468; x=1690442468; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MFRRXKFf+0w26EofWMAuGfN90Vrj6O/XJgBSSHzUhq4=; b=NGZZizsOdn2N0ieggQ1TJlxEkNMjjfcXNw9S5cFit1V23MBm+Fgw8cONfOO6rME3r5 GxVro7w/DZBtXz77jmU9LmAb7x1LwNCLQo0vykCiNOkYclmIY70U1XGaU8fhsLjPdfZG m28LygY5oiu/WPV86cqtEFwpiPKp1+0pbyL6UL1EE9L9djm1xejrw9EEC/E+5+YOEL8s iHaSP+rypTlyTUufFWBoC4sBhuedvr4aEXkwphJjmY1EylTgRQki3RgVuZ2lsxsvU3Hn T3ad6T13JWo1EmqYcYz3honuGrDwdZSkY1YMOtDpFJpkn4OjbY6F0EnL/QFcmjLDE0Ek BXUg== X-Gm-Message-State: AC+VfDwR3hyKhIaGgLM0QsELesIDv1b84onHaOqMj0lXNT7SsO88/zGe bpxCYOtmJjgmcGF3PZF+WxA+c8WNKqC9UGBnsEHPNfRv X-Google-Smtp-Source: ACHHUZ4R9iUQVwQ3OoJ7rhCU0TasgesF2LtBN9IW+dGtyk+6EHAc1vefJKGTTMm3mnavF7TVcF6+rddLHijZ4qqMRvA= X-Received: by 2002:a2e:a3d8:0:b0:2b6:9909:79c6 with SMTP id w24-20020a2ea3d8000000b002b6990979c6mr3803588lje.53.1687850467981; Tue, 27 Jun 2023 00:21:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 27 Jun 2023 09:20:55 +0200 Message-ID: Subject: Re: [PATCH] gengtype: Handle braced initialisers in structs To: Richard Sandiford , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Jun 27, 2023 at 7:38=E2=80=AFAM Richard Sandiford via Gcc-patches wrote: > > I have a patch that adds braced initializers to a GTY structure. > gengtype didn't accept that, because it parsed the "{ ... }" in > " =3D { ... };" as the end of a statement (as "{ ... }" would be in > a function definition) and so it didn't expect the following ";". > > This patch explicitly handles initialiser-like sequences. > > Arguably, the parser should also skip redundant ";", but that > feels more like a workaround rather than the real fix. > > Tested on aarch64-linux-gnu & x86_&4-linux-gnu. OK to install? OK. > Richard > > > gcc/ > * gengtype-parse.cc (consume_until_comma_or_eos): Parse "=3D { ..= . }" > as a probable initializer rather than a probable complete stateme= nt. > --- > gcc/gengtype-parse.cc | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/gengtype-parse.cc b/gcc/gengtype-parse.cc > index 2b2156c5f45..19184d77899 100644 > --- a/gcc/gengtype-parse.cc > +++ b/gcc/gengtype-parse.cc > @@ -450,6 +450,12 @@ consume_until_comma_or_eos () > parse_error ("unexpected end of file while scanning for ',' or ';= '"); > return false; > > + case '=3D': > + advance (); > + if (token () =3D=3D '{') > + consume_balanced ('{', '}'); > + break; > + > default: > advance (); > break; > -- > 2.25.1 >