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.96) (envelope-from ) id 1vQYQc-00B61c-0j for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 22:00:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQYQb-00A7Ab-04 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Dec 2025 22:00:57 +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.96) (envelope-from ) id 1vQYQa-00A79g-1z for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 22:00:56 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQYQY-002osa-1K for pgsql-hackers@lists.postgresql.org; Tue, 02 Dec 2025 22:00:56 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7c75a5cb752so3664316a34.2 for ; Tue, 02 Dec 2025 14:00:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764712854; x=1765317654; darn=lists.postgresql.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=DH1fkGKvChIBXg4Fk+QVuG3Teutojcmy1g84qe41EtA=; b=TI8MsN+SA+nB6r2blu6LbFWKNRrSHtRCXxRW8P2TzayyeHNXEy0UkSYZkzQIYhIFtK 5fQ8xzNVl+H0SJnBju4CPBm066NHiMHrnfGM57k6wdVD5lDdGh+PfkoMXvP7WnMHZLO5 dtJWenOT6gBRWitFyYi1q1m4zIOxv7XJxaHtZVcsO8VHEOgqivQ3DQrVc7pa1u7XWwax CqWzIbjPLOO46qhV7hdr9DkilIuRBmV5mCeezgnO+uFvOeqMSRhFs1IRElDNkFLO3JFC VWWLjuKF1/F1dYtiRhjm6r3Z9SlX8xbL7L6BAeZ+mXwjR8+OxeEs64pWk68nG5O3u9sD k9yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764712854; x=1765317654; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DH1fkGKvChIBXg4Fk+QVuG3Teutojcmy1g84qe41EtA=; b=Y8nd/PR1idIRd4FhVvlNCYrQtmrk6EsfFAEDbh2H00Gm+hpiAGx/ZgBZYA79H1hOAK cuhx53E46i0G3ygV0/rXItAIdZ0OjtK0rVUN+jDltxkFHma9RCP2AlNwlNPuN+lIaFYa zVDHKAoBHfyOvd6TOLsPsdGVPU+IZBzwiRb+zCNRs/7rlb6ylfDflnHf6NWwqRnsZ8Dj BA+xTxmx98ZLTighVpZqAdJ5L2ercfKBD2z6NAc6HYq9MSovdxfZ/KvCor18KF7+LnsV 7pR2+CbIB8wFt8j+2v9rs8PLOBvEkvkcwmiwXgEd4gIbQhYeL0TLcQu7OC6Uu37CEJqe y4rQ== X-Forwarded-Encrypted: i=1; AJvYcCXRCTuDMLN4SweQuy+7SC2GMQBXhs43vqSzax4/80gM8zsNAciL/7b4lO2iZGhGRK0jDqozySYc/kt3T4C4@lists.postgresql.org X-Gm-Message-State: AOJu0Yw3Xr2UjvLCAV33lLedfk2Mj2eCkEVWsH6vvBQOJbBn9VlimcTP VCagrKxkr3c/T1Xwt1b83rFSJnRD+ZcXa9m3xNcuhfH4PMSxQGKugdin X-Gm-Gg: ASbGnctl0PKCMbi1ZKIJ1yGR6YF4DvqgVyBSzW1alU4qF8Oozpwe4rx7W8337HaQugt rY61TtIEJnYM9PwFdIhpcBUEtmsgixFNQuJmKs1a9RMM7G2RKYsaB+xx3gorGbb9vQHx6m0bNdx yiWtkF9GdVKiWQbv9WR8ogXVltq8r6pRJ1A04byQwhqFWaopszzeIpMqvXatPlR6g2WNKreAhUQ 40Wi23SpehGdwiHMba4edqRZ+unRNz5rp57y4IdMFSiKOxw6aUifcqdVH/YwBNSSFilnkobRoRr hg23RAd5+NMLgW/Qg0i66u7V5ixVqSmCyY3V0X1SVx5QxypjZTzaFS1Xl4RY/71MGxtMJdEyU4r bGwTJE0HKlwQHk/xZZShnyoXJ32fX/3ngx+kPUaBthRqIu1RSkJ3iY/IsgWsm8Qp4FIpMotkMBx YN+u1uNXlK3NTyh0I/+WfLSFMg3xg4X//tnCjT19l48mob1ZXLky/UDjApC0VGseY0K7diPNauc wDI X-Google-Smtp-Source: AGHT+IGvMHULDemlGVVpRt6b3LhGvEUHhTXZDceIEgpYI1IvQKTNx+nf6EG1eaahU6NLN6mMP+h6Cw== X-Received: by 2002:a05:6830:4389:b0:7c7:261:6745 with SMTP id 46e09a7af769-7c94da269d7mr174760a34.8.1764712854275; Tue, 02 Dec 2025 14:00:54 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-65933cc3fb2sm4737689eaf.11.2025.12.02.14.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 14:00:53 -0800 (PST) Date: Tue, 2 Dec 2025 16:00:51 -0600 From: Nathan Bossart To: Chao Li Cc: Rahila Syed , Robert Haas , PostgreSQL Hackers Subject: pgindent versus struct members and typedefs Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Dec 01, 2025 at 05:04:23PM -0600, Nathan Bossart wrote: > On Tue, Dec 02, 2025 at 05:35:34AM +0800, Chao Li wrote: >> ``` >> + else if (entry->type == DSMR_ENTRY_TYPE_DSH && >> + entry->dsh.dsa_handle !=DSA_HANDLE_INVALID) >> ``` >> >> Missing a white space after !=. > > I agree, but for some reason, pgindent insists on removing that space. I'm > leaving that for another thread. So, this seems to have something to do with the struct member having the same name as a typedef. If I rename the member, pgindent adds the space as expected. Interestingly, changing the != to a == also fixes the spacing. There are a couple of other examples in the code: src/backend/storage/ipc/dsm_registry.c: entry->dsh.dsa_handle !=DSA_HANDLE_INVALID) src/backend/replication/logical/logicalfuncs.c: ctx->options.output_type !=OUTPUT_PLUGIN_TEXTUAL_OUTPUT) src/bin/pg_basebackup/pg_basebackup.c: if (state.manifest_file !=NULL) src/bin/pg_basebackup/pg_basebackup.c: state->manifest_file !=NULL) src/bin/pg_basebackup/pg_basebackup.c: else if (state->manifest_file !=NULL) I used the following command to find these: grep -E "!=[A-Za-z]" ./* -rI AFAICT this is a special case of the note added to pgindent's README by commit c4133ec: pgindent will mangle both declaration and definition of a C function whose name matches a typedef. Currently the best workaround is to choose non-conflicting names. I tried to fix pgindent for a few, but the code is basically impenetrable. I didn't find any fixes upstream [0], either. As noted above, we could also fix it by avoiding the naming conflicts. However, I can't imagine that's worth the churn, and I've already spent way too much time on this, so IMHO the best thing to do here is nothing. [0] https://github.com/freebsd/freebsd-src/tree/main/usr.bin/indent -- nathan