From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by sourceware.org (Postfix) with ESMTPS id 5E2A93858D28; Fri, 10 Feb 2023 12:50:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E2A93858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id D80636000D; Fri, 10 Feb 2023 12:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seketeli.org; s=gm1; t=1676033407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H8zP3EzDj5iGXXcmOx9yUfBvOKuiYmV4+18JWUuLD+w=; b=iM3sdQUMaR0oKTcpTSibfM1wRTCCMbKNf4k6OkP8yHPhFHU8PN9xPCDh6v8f61R1w/LbjW jsBIKgZFpL/jGS3XZRfpQlUw6D1tDhP7O+a7RsIsXb6br100AlREZQ1a5LWP+XCgZcvsmr Yu7Td0+ccXyTyUuE7jmXUQElKCzCMywsZo5H877CEpgK6yh+h5oZF+fBvrx+0jAhuu7Afv rfqiX9Yv6L4NcI0C8bOv2UNV5fIs4J5wQNgMskwZiAAq/QcS8yA8IhirmKTMFTa8+9etIp DsNDjLh4RgF1w4W7JSn4yepc/pOU8U2TnWipKZ2RxIysL1hLEugUXfDrOtan4Q== Received: by localhost (Postfix, from userid 1000) id B6423581C59; Fri, 10 Feb 2023 13:50:05 +0100 (CET) From: Dodji Seketeli To: gprocida at google dot com via Libabigail Cc: gprocida at google dot com Subject: Re: [Bug default/30048] incorrect qualifiers within compound types Organization: Me, myself and I References: X-Operating-System: Fedora 38 X-URL: http://www.seketeli.net/~dodji Date: Fri, 10 Feb 2023 13:50:05 +0100 In-Reply-To: (gprocida at google dot com via Libabigail's message of "Wed, 08 Feb 2023 13:08:33 +0000") Message-ID: <87k00pn0qq.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_LOW,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 List-Id: Hello Giuliano, gprocida at google dot com via Libabigail a =C3=A9crit: > I don't feel qualified to review the code change OK, no problem, I understand. > and I haven't had the chance to patch and test it (but I'm sure you > have!). No problem. And yes, I have tested it against the reproducer of this problem report. > However, I can offer some test case suggestions. > > Firstly, printing out C types is a hard problem! Heh. Yeah, I know. Libabigail's implementation is a bit different from the standard C or C++ one, even if it's very close. There are things that are simplified so that it looks easier to understand. Also, by default, it could be look not too much "alien" for compilers of other languages that might have produced the type info we are looking at. > I worked on an implementation > that seems to have mostly survived over a year or so of use: > > https://android.googlesource.com/platform/external/stg/+/refs/heads/maste= r/naming.h > https://android.googlesource.com/platform/external/stg/+/refs/heads/maste= r/naming.cc > > The important code here is Name, which consolidates precedence handling, = and > the Describe function object, which works recursively on the type graph. I > documented the original design approach here: > > https://android.googlesource.com/platform/external/stg/+/refs/heads/maste= r/doc/NAMES.md > > I think the main takeaway is that qualifiers can be "tacked on" without > disturbing the rest of the code too much but some contextual awareness is > needed to make sure the qualifiers end up on the correct side with approp= riate > whitespace. It would have been significantly easier if the world (or C it= self) > just had "int const" and not "const int". Thanks! > In terms of testing... this is my torture test for naming and diffs. The > comments are (or at least were at one point) valid input for cdecl(1). > > Please feel free to use or adapt this for libabigail. If you need copyrig= ht / > licence attribution it's: Google Inc. 2020, LLVM licence (Apache + LLVM > exception), same as libabigail. [...] Thanks! I have added this test to the libabigail test suite. After (hopefully carefully) starring at the report of abidiff on it, it looks like the output is what I would expect, with the patch I proposed. I thus went ahead and applied the patch to the master branch at https://sourceware.org/git/?p=3Dlibabigail.git;a=3Dcommit;h=3D03d8b52fc7a51= 0edaf3182a3600cc54c0a180fe7. Thanks! --=20 Dodji