Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uSLxb-006U8w-Vu for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jun 2025 20:34:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uSLxZ-00EgAU-7R for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jun 2025 20:34:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uSLxY-00EgAL-U1 for pgsql-hackers@lists.postgresql.org; Thu, 19 Jun 2025 20:34:09 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uSLxX-002woh-2q for pgsql-hackers@lists.postgresql.org; Thu, 19 Jun 2025 20:34:08 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-70f94fe1e40so12356487b3.1 for ; Thu, 19 Jun 2025 13:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750365247; x=1750970047; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ey+7PP6B7H6IvGK3ntJr9lyeDBZ3iz6fgL4BInpvUUk=; b=djmWTIkSunGSSM3q0Um8zQg7hJdMN3XnZAYSp64lSUfggtGUEMVCjAHocI2t1HcI7/ dxx/yYUlZ0FHPBxxd1tnLfuYqiGfgQ+k7gAptzhe+VQMl4L6xfgyks8q4IyL+bUpjz1o uqDATCoavzMpQeRXYtaSvbbqJXLAw0TwCncns0Rnpno6pzv90K5YkXLw1CVbVj/n5Lv9 my8hia1+Cy0M6nJovE2M2gSK4y+CjDTvG1RxVkFHYMI08dZxjATzwLSZSQ3N7yW0E/UC FaWYM0VGuzuoWGPzFk8RNLPTvtNlzw6QouHvR5r6s+e/tM83Iam3jgB9DfifoZvaiDzB nUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750365247; x=1750970047; h=content-transfer-encoding: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=Ey+7PP6B7H6IvGK3ntJr9lyeDBZ3iz6fgL4BInpvUUk=; b=J5hqzgKPZtNYO1kqfLDwnmi6phSmysjRHlzPxOTPpvXxSiyVO0Ckrlgb4SqG29zPUh bavq8L3yn7zqJDbgofOf3RF8syuclkVGUy1VNWHTu4QweCKLtWPJX7yoVKTEuwgEFJlJ HYx/CDya4cCMAlNq+iI4Jsjios7oHReC7jEe1tIyuYjqkLom1HG9UI+bvguutDg2HzLq jeFFrx+LjeuI6HnF2M+vyz35/VbTPaP4OlRRzoQOITexhB1eL8fmMfcuOhUt9uEFfNr0 sDJXKDOPu+4kdUoObkrjCRfsJD6C6PvPAhQmwolVkg3r0PSGb+tEBOFCEtoSRoNAX5zK YgAw== X-Gm-Message-State: AOJu0YwS8ESd7+MeX5hCL5afDkGMrbP7+LgVmBET99Sw+eqKDWEPjlGP M+I3RxM6nWB0xQyB4wla6foXfhDNAuy1A3Z3ebPn+UZAjSVHnfjkRgsx+vCsQDZ/C0aNN70TIZu xTDCuz/a1OmV7Q4Mc0kx6aHDLHR+3dZw= X-Gm-Gg: ASbGncv5rOudLwk5wOVlS2dxK5LqNuWGiSBO+sNdLHVUbdJxgCq6IygBUPNfdVBkyVY vlRoCbMkpnD7Gvsm7SD2yaY9VBr5GM7MkS+YFsUnkveuZ7beOIaEgt82RcFJuq3z4PtdSvAtZmM HQgxfa17+RnQKuCF2VIxs35Pj2Jst7vRjmNukOFbLlUY0Q X-Google-Smtp-Source: AGHT+IGcmcwRpXhDaxtWKl6FVvxpdBsWVlw7kmE9rY6MnYuB15hC3U2Zk6ZptiFufKAIQxNY9NkvISrGWQtw4HG9D7I= X-Received: by 2002:a05:690c:3584:b0:711:6ea1:8d12 with SMTP id 00721157ae682-712c771719dmr5577777b3.1.1750365247016; Thu, 19 Jun 2025 13:34:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arseniy Mukhin Date: Thu, 19 Jun 2025 23:33:55 +0300 X-Gm-Features: AX0GCFtSHEp87YYOrpe5A17oykwLk4GrIWoxqcAo5spo3tmy4b3_AWgfsbKEEKE Message-ID: Subject: Re: [PATCH] pg_bsd_indent: improve formatting of multiline comments To: Aleksander Alekseev Cc: PostgreSQL Hackers , Michael Paquier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jun 19, 2025 at 5:51=E2=80=AFPM Aleksander Alekseev wrote: > > Hi, > > Michael (cc:'ed) pointed out [1] that pg_bsd_indent could do a > slightly better job when it comes to formatting multiline comments. I > prepared a patch that fixes this. > > How to test it: > > ``` > ninja -C build > cp build/src/tools/pg_bsd_indent/pg_bsd_indent ~/bin/pg_bsd_indent > cp src/tools/pgindent/pgindent ~/bin/pgindent > pgindent src/backend/utils/adt/varlena.c > git diff > ``` > > Expected changes: > > ``` > -/* name_text() > +/* > + * name_text() > * Converts a Name type to a text type. > */ > ``` > > Everything else should work as before. > > Thoughts and feedback are most welcomed. > > [1]: https://postgr.es/m/CAJ7c6TN7ppSmZMPejvKZreOs%3D%2BkJEhrGQNuVpmTjj9W= -%3DMjgCg%40mail.gmail.com > > -- > Best regards, > Aleksander Alekseev Hi Aleksander! Thank you for the patch! I tried it with the whole project and almost always it works great. But I noticed two cases where it works probably not as expected: 1) comments which don't have a star on each line. For example: file 'cube.c' before: /* make up a metric in which one box will be 'lower' than the other -- this can be useful for sorting and to determine uniqueness */ after: /* * make up a metric in which one box will be 'lower' than the other -- this can be useful for sorting and to determine uniqueness */ 2) comments where closing */ is on the last comment line. For example: file 'crypt-blowfish.c' before: /* This has to be bug-compatible with the original implementation, so * only encode 23 of the 24 bytes. :-) */ after: /* * This has to be bug-compatible with the original implementation, so * only encode 23 of the 24 bytes. :-) */ Best regards, Arseniy Mukhin