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 1vipy8-00Gilh-08 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 08:23:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vipy6-00Bxba-36 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 08:23:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vipy6-00BxbS-29 for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 08:23:06 +0000 Received: from mail-dy1-x132f.google.com ([2607:f8b0:4864:20::132f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vipy4-001s2e-2i for pgsql-hackers@postgresql.org; Thu, 22 Jan 2026 08:23:06 +0000 Received: by mail-dy1-x132f.google.com with SMTP id 5a478bee46e88-2b6fd5bec41so1357158eec.1 for ; Thu, 22 Jan 2026 00:23:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769070182; x=1769674982; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4AJ/wuj2gUv25cjo9vcCRuVFm+AbbioFg9SqIWnEF1s=; b=Qvj6XV7ZFIntQEtUZoFJSYDlWqOduLLxPXcg5Nq2nTsLlBp+EBc/3lWuVqHf2EA4vE tLvdb+qVfS3vcZzRqOLWrcfoUdsMRqDv8rJT9KHIdWbd+TMh9p3sQdGrLQEQvPOdBBu6 Hz8DSbj4hT5MGgJ7j9ybKAL0FxqgwLGnOYnfMBrPrHU8pDfJzjslLCimIrkWU4qdCl99 V+SJY/+ZrCm4oL2iN4Irc0OY1ZdDgOCPhOlNBL1SxwzCy06xtj+Qur7ZYyXz/+tU2vVZ qls+GyjaG3cOmE2U3vgJbydvVi7j28+E27/WGaSI/iVV4AayIP+RnAHs/P3g52h1RCtN mh0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769070182; x=1769674982; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4AJ/wuj2gUv25cjo9vcCRuVFm+AbbioFg9SqIWnEF1s=; b=R0aJ/vzekX3RTj0cfSvO8kDeAsxE7d+zVKTv0562cWpRczN8D3YvURk67YqGVxVPBc dcBkgx20qeIDQOxHZSxiLYucighFRaTU7w9RBXYeyc6ED7iqHAV1/KPS58fOKlJCQToT 0iV5V9p/KN+Wn/ABcO05F2xY7z8W9z5p7vpN8Nzqngk7+GM2XCyGL883sFZfrBepa2io zkfoe+su4Y6J+BwFo/215CzFXcEVgCp79jSFcQ3LiDlQmSXexDRHyRRw3ULC0YW2X5zX uez8hwXatc3VvKCEqk5cVBxnckcXyiUR2e4pD3eruczYoQQ/7ghPryu5TzALm7lFY95U IlQw== X-Gm-Message-State: AOJu0YyhtHKezSiniutsEFbsiT4EbzS7jpMi0sO1zVi5vqcblQGi6oNt EoyTLileaWD5560pA+7C9Cc3SAKfJ2c2wIxwuBzkw2rs79t1+cNKqAmf X-Gm-Gg: AZuq6aLnKTmttQ6L2VEkmP68lA/nexvOrahxU2mzumSS3T00NMRAxthWa89PbKL8/Ep qdgxr53qbZFtWIh3VKZNPnbgGiEH2wtkcp4dJ9OiyAHpv5i3YREClNDF4g9oURI0Qr3WEZALMD5 DpGIWGOTEOACeOlNtkhn9N+yHe+/6c31Kg59BoB2TlKTlitkN46jtmzFZLNfecA7j9zibjumkfd LqzyzN8lnJO+uiJy3wcTc4I4a6E+YAyG3x0RWx+YioPt0hnJHzKel6fU540MgwUKURhBomIA3Ss Ckui5H/gIRvxZANr3l2MtMO4Cnh0Uhfgieq2EtBhs0qGAMK0z7vD3bFKoP4DornM8+2dTVaar27 4OoktagVE0zQMBzJXz0nGDxQBJ3VDfd5uHMTeZYfle+t1dPCtSwio2Ip50khgu1XglZmPtr74By zquB1B79+3SxIKlqXK8hTH X-Received: by 2002:a05:7300:230f:b0:2b7:1253:3d42 with SMTP id 5a478bee46e88-2b7125358cbmr2521726eec.24.1769070181841; Thu, 22 Jan 2026 00:23:01 -0800 (PST) Received: from smtpclient.apple ([196.247.24.158]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b712881482sm6347098eec.5.2026.01.22.00.22.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2026 00:23:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: Fix accidentally cast away qualifiers From: Chao Li In-Reply-To: Date: Thu, 22 Jan 2026 16:22:24 +0800 Cc: pgsql-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <5C33CCDF-7A95-4757-B35A-CA62C2D77F31@gmail.com> References: To: Bertrand Drouvot , Peter Eisentraut X-Mailer: Apple Mail (2.3864.300.41.1.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jan 21, 2026, at 22:56, Bertrand Drouvot = wrote: >=20 > Hi, >=20 > On Wed, Jan 21, 2026 at 02:24:58PM +0000, Bertrand Drouvot wrote: >> Hi, >>=20 >> On Wed, Jan 21, 2026 at 12:31:27PM +0100, Peter Eisentraut wrote: >>> Strange, I don't see that. What compiler is this, and do you use = any >>> special options? >>=20 >> It's gcc 14.1.0 with "CFLAGS=3D-O0 -ggdb3 -fno-omit-frame-pointer = -gdwarf-2 -g3 >> -Wdiscarded-qualifiers -Wunused-value -Werror=3Dmaybe-uninitialized >> -Werror=3Dformat -Wreturn-type" >>=20 >> But I just tested with a simple test case, some compilers and some = options and I've >> always seen the warning (see [1]) >=20 > FWIW, and so does the CI: = https://github.com/bdrouvot/postgres/runs/61028037498 >=20 > Regards, >=20 > --=20 > Bertrand Drouvot > PostgreSQL Contributors Team > RDS Open Source Databases > Amazon Web Services: https://aws.amazon.com >=20 Yeah, I confirm I can see the same warnings: ``` In file included from xlogdesc.c:21: In file included from ../../../src/include/utils/guc.h:17: In file included from ../../../src/include/utils/array.h:65: In file included from ../../../src/include/utils/expandeddatum.h:47: ../../../src/include/varatt.h:307:9: warning: returning 'const char[]' = from a function with result type 'char *' discards qualifiers = [-Wincompatible-pointer-types-discards-qualifiers] 307 | return VARDATA_4B(PTR); | ^~~~~~~~~~~~~~~ ../../../src/include/varatt.h:261:26: note: expanded from macro = 'VARDATA_4B' 261 | #define VARDATA_4B(PTR) (((const varattrib_4b *) = (PTR))->va_4byte.va_data) | = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../src/include/varatt.h:321:9: warning: returning 'const char[]' = from a function with result type 'char *' discards qualifiers = [-Wincompatible-pointer-types-discards-qualifiers] 321 | return VARDATA_1B(PTR); | ^~~~~~~~~~~~~~~ ../../../src/include/varatt.h:263:26: note: expanded from macro = 'VARDATA_1B' 263 | #define VARDATA_1B(PTR) (((const varattrib_1b *) = (PTR))->va_data) | = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../src/include/varatt.h:342:9: warning: returning 'const char[]' = from a function with result type 'char *' discards qualifiers = [-Wincompatible-pointer-types-discards-qualifiers] 342 | return VARDATA_1B_E(PTR); | ^~~~~~~~~~~~~~~~~ ../../../src/include/varatt.h:264:27: note: expanded from macro = 'VARDATA_1B_E' 264 | #define VARDATA_1B_E(PTR) (((const varattrib_1b_e *) = (PTR))->va_data) | = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../src/include/varatt.h:488:9: warning: returning 'const char *' = from a function with result type 'char *' discards qualifiers = [-Wincompatible-pointer-types-discards-qualifiers] 488 | return VARATT_IS_1B(PTR) ? VARDATA_1B(PTR) : = VARDATA_4B(PTR); | = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../src/include/varatt.h:235:2: note: expanded from macro = 'VARATT_IS_1B' 235 | ((((const varattrib_1b *) (PTR))->va_header & 0x01) =3D=3D= 0x01) | ^ 4 warnings generated. ``` I didn=E2=80=99t use any special compiler option, just ran =E2=80=9Cmake=E2= =80=9D. My configure is: ``` ./configure --enable-debug --enable-cassert --enable-tap-tests = --enable-depend ``` Sorry, I didn=E2=80=99t notice the warnings in my first review. I guess = I left my desktop while building at the time. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/