[[deprecated("don't call this, call that")]]
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-09T03:34:30Z
Lists: pgsql-hackers
Attachments
- 0001-Provide-pg_attribute_deprecated-message-macro.patch (text/x-patch) patch 0001
- 0002-Mark-pg_mblen-and-t_is-as-deprecated.patch (text/x-patch) patch 0002
- 0003-Remove-pg_mblen-and-related-functions.patch (text/x-patch) patch 0003
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.