From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BECCB3857726 for ; Wed, 27 Sep 2023 16:15:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BECCB3857726 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695831322; 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: in-reply-to:in-reply-to:references:references; bh=CJ2zp/8wt+NLj9BNnxOf6gkTUn6Q2HQ+b6RYW0pMxvg=; b=PDbf9XI3bQAAQPaaN83gnzR9yqPaFo2z70r8kttb1ge9UeeXtqJjlpn1OTC9e+sDfs4t4A iGGJ1g/G5cfS3AfUBaysogVBufdGV0vscd5LRkPkCo6y0M37OY+z4krwiQX8Qc/yb8siEN Rxs4hmyaBvbjzgP5WInsBts6B7A6Q5M= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-Ac6vcW3lOe6Th6I7ka7eHg-1; Wed, 27 Sep 2023 12:15:20 -0400 X-MC-Unique: Ac6vcW3lOe6Th6I7ka7eHg-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c135cf13e1so167786961fa.0 for ; Wed, 27 Sep 2023 09:15:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695831318; x=1696436118; h=cc: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=CJ2zp/8wt+NLj9BNnxOf6gkTUn6Q2HQ+b6RYW0pMxvg=; b=nVL26XYtTG0kg3o2nLkC2CXFhN+wpT+IsZbW0ySB75jl4tjvit2CzB+OFEaQt31p77 e1APQiQUxKId329xHXe1ATLPdbf2WHF4B8Ea++Hm48XK6orJPJUANmTJpOmQxMWGxLfX BsbDbxoV5J/nKyqXulqQOSwYmdRtdGPSNdWSURaya8PQafEW1707QBc9V+2eSJL7eHwk d0NxbBdeY5FIADFlknGvOrcxJSN/V3My9KCpKyMDhxLggy0N1TYjtI+U44LvZcLST63y GtDUcwVJWKCY8f+6CGRShiw9m4nOTyAiOmgGemjGbcKRx99+mOuydpuysswAnRTMaien +I/g== X-Gm-Message-State: AOJu0YxEBB0BUi5jF7JgWzTeerDg5yW8VqsqHvKMrNAR3064cKq5kUwI QdWzEm+PiftFDIoCjRa8RxXzkL2WmCsxvp/w4iPMdLEGOvnfFz5/bmQRNfhKrKPI888SSjDFiNi pGfymIGYwUbjYXein7XjBZSd1gHEXsyE= X-Received: by 2002:a2e:b6cd:0:b0:2bc:e51d:d09c with SMTP id m13-20020a2eb6cd000000b002bce51dd09cmr2331278ljo.36.1695831318809; Wed, 27 Sep 2023 09:15:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHb0+CJk0aFg9t9vtJQNojD1TNoxiQejmD7+caDzKBK4R9740Vf4gXI2fEdgz+jFb2cBQRk0qlpXyv2lKym2sY= X-Received: by 2002:a2e:b6cd:0:b0:2bc:e51d:d09c with SMTP id m13-20020a2eb6cd000000b002bce51dd09cmr2331258ljo.36.1695831318386; Wed, 27 Sep 2023 09:15:18 -0700 (PDT) MIME-Version: 1.0 References: <20221222233804.772229-1-jwakely@redhat.com> <878r8r4og4.fsf@tromey.com> In-Reply-To: <878r8r4og4.fsf@tromey.com> From: Jonathan Wakely Date: Wed, 27 Sep 2023 17:15:07 +0100 Message-ID: Subject: Re: [committed] libstdc++: Add GDB printers for types To: Tom Tromey Cc: Jonathan Wakely via Gcc-patches , libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="0000000000005587970606597f1a" X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: --0000000000005587970606597f1a Content-Type: text/plain; charset="UTF-8" On Wed, 27 Sept 2023 at 16:37, Tom Tromey wrote: > > >>>>> Jonathan Wakely via Gcc-patches writes: > > Replying to a quite old email... > > I ran a Python linter on the libstdc++ pretty-printers. > > I have fixes for most of the issues that are worth fixing (I didn't > bother with line lengths -- FWIW in gdb we just run 'black' and don't > worry about these details), I used autopep8 and committed the result as e08559271b2d797f658579ac8610dbf5e58bcfd8 so the line lengths should be OK now. > but the patch I'm replying to had a problem > that I didn't know how to fix: > > > +class StdChronoTimeZoneRulePrinter: > [...] > > + if kind == 0: # DayOfMonth > > + start = '{} {}{}'.format(month, ordinal_day) > > flake8 points out that this call to format has three placeholders but > only two arguments. Oops, I think it was originally written like this: '{} {}{}'.format(month, day, suffixes.get(day, 'th')) but then I refactored it to: ordinal_day = '{}{}'.format(day, suffixes.get(day, 'th')) if kind == 0: # DayOfMonth start = '{} {}{}'.format(month, ordinal_day) So the fix is to just change the string to '{} {}' which I've pushed as 1fab05a885a308c19cf42b72fd36805ddf27fdc8 now (also attached). These printers are for implementation details internal to the library, which are never exposed to users. I added them because they made it much easier to debug the implementation when stepping through library functions, but that means there are no tests for them. Thanks for finding this! --0000000000005587970606597f1a Content-Type: text/plain; charset="US-ASCII"; name="patch.txt" Content-Disposition: attachment; filename="patch.txt" Content-Transfer-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DogICMgRGF5 T2ZNb250aAotICAgICAgICAgICAgc3RhcnQgPSAne30ge317fScuZm9ybWF0KG1vbnRoLCBvcmRp bmFsX2RheSkKKyAgICAgICAgICAgIHN0YXJ0ID0gJ3t9IHt9Jy5mb3JtYXQobW9udGgsIG9yZGlu YWxfZGF5KQogICAgICAgICBlbHNlOgogICAgICAgICAgICAgd2Vla2RheSA9IHdlZWtkYXlzW29u WydkYXlfb2Zfd2VlayddXQogICAgICAgICAgICAgaWYga2luZCA9PSAxOiAgIyBMYXN0V2Vla0Rh eQo= --0000000000005587970606597f1a--