It appears in macOS SDK 14.5, there were include guards in $SDK_ROOT/usr/include/xlocale/_regex.h:
#ifndef _XLOCALE__REGEX_H_
#define _XLOCALE__REGEX_H_
#ifndef _REGEX_H_
#include <_regex.h>
#endif // _REGEX_H_
#include <_xlocale.h>
In macOS SDK 15.5, these include guards are gone:
#ifndef _XLOCALE__REGEX_H_
#define _XLOCALE__REGEX_H_
#include <_regex.h>
#include <__xlocale.h>
Since _REGEX_H_ was defined locally in PostgreSQL's version of src/include/regex/regex.h, these include guards prevented duplicate definitions from /usr/include/_regex.h (not to be confused with /usr/include/xlocale/_regex.h).
If I hack the PostgreSQL src/include/regex/regex.h to include the double underscore include guard of __REGEX_H_, the build succeeds:
```
diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h
index d08113724f..734172167a 100644
--- a/src/include/regex/regex.h
+++ b/src/include/regex/regex.h
@@ -1,3 +1,6 @@
+#ifndef __REGEX_H_
+#define __REGEX_H_ /* never again */
+
#ifndef _REGEX_H_
#define _REGEX_H_ /* never again */
/*
@@ -187,3 +190,5 @@ extern bool RE_compile_and_execute(text *text_re, char *dat, int dat_len,
int nmatch, regmatch_t *pmatch);
#endif /* _REGEX_H_ */
+
+#endif /* __REGEX_H_ */
```
Any better ideas here?