aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-08-06 13:32:29 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-08-06 13:32:29 -0400
commit5c7121bcf8dbe94344742a5cd0fa0f016b7a76a1 (patch)
tree5ad9e748df872591b6a29bd01b770290483dcb57 /src
parent692df425b6883dd3edcc15bb984415ef349fafb1 (diff)
downloadpostgresql-5c7121bcf8dbe94344742a5cd0fa0f016b7a76a1.tar.gz
postgresql-5c7121bcf8dbe94344742a5cd0fa0f016b7a76a1.zip
Fix function-defined-but-not-used warning.
Buildfarm member jacana (MinGW) has been complaining that get_iso_localename is defined but not used. This is evidently fallout from the recent removal of VS2013 support in pg_locale.c. Rearrange the #ifs so that get_iso_localename and its subroutine search_locale_enum won't get built on MinGW. I also noticed that a comment in get_iso_localename cross- referenced a comment in IsoLocaleName that isn't there anymore. Put back what I think is the referenced material.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/pg_locale.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 607a4b73407..1a047a97d74 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -118,7 +118,7 @@ static HTAB *collation_cache = NULL;
#if defined(WIN32) && defined(LC_MESSAGES)
-static char *IsoLocaleName(const char *); /* MSVC specific */
+static char *IsoLocaleName(const char *);
#endif
#ifdef USE_ICU
@@ -950,6 +950,8 @@ cache_locale_time(void)
* [2] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
*/
+#if defined(_MSC_VER)
+
/*
* Callback function for EnumSystemLocalesEx() in get_iso_localename().
*
@@ -1088,8 +1090,11 @@ get_iso_localename(const char *winlocname)
return NULL;
/*
- * Simply replace the hyphen with an underscore. See comments in
- * IsoLocaleName.
+ * Since the message catalogs sit on a case-insensitive filesystem, we
+ * need not standardize letter case here. So long as we do not ship
+ * message catalogs for which it would matter, we also need not
+ * translate the script/variant portion, e.g. uz-Cyrl-UZ to
+ * uz_UZ@cyrillic. Simply replace the hyphen with an underscore.
*/
hyphen = strchr(iso_lc_messages, '-');
if (hyphen)
@@ -1103,7 +1108,6 @@ get_iso_localename(const char *winlocname)
static char *
IsoLocaleName(const char *winlocname)
{
-#if defined(_MSC_VER)
static char iso_lc_messages[LOCALE_NAME_MAX_LENGTH];
if (pg_strcasecmp("c", winlocname) == 0 ||
@@ -1114,10 +1118,18 @@ IsoLocaleName(const char *winlocname)
}
else
return get_iso_localename(winlocname);
+}
-#endif /* defined(_MSC_VER) */
- return NULL; /* Not supported on this version of msvc/mingw */
+#else /* !defined(_MSC_VER) */
+
+static char *
+IsoLocaleName(const char *winlocname)
+{
+ return NULL; /* Not supported on MinGW */
}
+
+#endif /* defined(_MSC_VER) */
+
#endif /* WIN32 && LC_MESSAGES */