[[deprecated("don't call this, call that")]]

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [[deprecated("don't call this, call that")]]
Date: 2026-04-09 03:34:30
Message-ID: CA+hUKGK2zuRevnNzCpVzLA7ieHnJoYPnDvgtWRcB4pVnOzchhQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While working on 1e7fe06c, I wished I could make functions generate
compiler warnings:

pg_attribute_deprecated("use pg_mblen_{cstr,range,with_len,unbounded} instead")
extern int pg_mblen(const char *mbstr);

That'd avoid accidental reintroduction, and also get extension
maintainers' attention. $SUBJECT is C23/C++14's syntax, but you've
long been able to do that with in __attribute__ or __declspec for the
usual suspects so I looked into which compiler versions introduced
that and came up with the attached.

The idea would be to back-patch the deprecation warnings, and delete
the functions in, I guess now, v20. Then the deprecation notice
facility would always be there for next time we need it.

Attachment Content-Type Size
0001-Provide-pg_attribute_deprecated-message-macro.patch text/x-patch 1.6 KB
0002-Mark-pg_mblen-and-t_is-as-deprecated.patch text/x-patch 1.7 KB
0003-Remove-pg_mblen-and-related-functions.patch text/x-patch 3.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-04-09 03:36:21 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message Chao Li 2026-04-09 03:33:43 Re: Add missing period to HINT messages