summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorThomas Munro2024-07-05 22:24:49 +0000
committerThomas Munro2024-07-05 22:27:16 +0000
commit2a5ef09830401071be64d4eff3f6db421263a880 (patch)
tree62ae8af42b2eac5433bfc6027d34ca8f3d1a3eea /src/tools
parent8212625e53f28ce2fb9f779f9fa5c003dba904d4 (diff)
Cope with <regex.h> name clashes.
macOS 15's SDK pulls in headers related to <regex.h> when we include <xlocale.h>. This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include <regex.h> explicitly on all POSIX systems, and fix everything that breaks. Then we can prove that we are capable of fully hiding and replacing the system regex API with our own. 1. Deal with standard-clobbering macros by undefining them all first. POSIX says they are "symbolic constants". If they are macros, this allows us to redefine them. If they are enums or variables, our macros will hide them. 2. Deal with standard-clobbering types by giving our types pg_ prefixes, and then using macros to redirect xxx_t -> pg_xxx_t. After including our "regex/regex.h", the system <regex.h> is hidden, because we've replaced all the standard names. The PostgreSQL source tree and extensions can continue to use standard prefix-less type and macro names, but reach our implementation, if they included our "regex/regex.h" header. Back-patch to all supported branches, so that macOS 15's tool chain can build them. Reported-by: Stan Hu <stanhu@gmail.com> Suggested-by: Tom Lane <tgl@sss.pgh.pa.us> Tested-by: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://postgr.es/m/CAMBWrQnEwEJtgOv7EUNsXmFw2Ub4p5P%2B5QTBEgYwiyjy7rAsEQ%40mail.gmail.com
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/pgindent/typedefs.list3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index e710fa48e59..9320e4d8080 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -3697,6 +3697,9 @@ pg_md5_ctx
pg_on_exit_callback
pg_prng_state
pg_re_flags
+pg_regex_t
+pg_regmatch_t
+pg_regoff_t
pg_saslprep_rc
pg_sha1_ctx
pg_sha224_ctx