Skip to content

Commit 5c7121b

Browse files
committed
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.
1 parent 692df42 commit 5c7121b

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static HTAB *collation_cache = NULL;
118118

119119

120120
#if defined(WIN32) && defined(LC_MESSAGES)
121-
static char *IsoLocaleName(const char *); /* MSVC specific */
121+
static char *IsoLocaleName(const char *);
122122
#endif
123123

124124
#ifdef USE_ICU
@@ -950,6 +950,8 @@ cache_locale_time(void)
950950
* [2] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
951951
*/
952952

953+
#if defined(_MSC_VER)
954+
953955
/*
954956
* Callback function for EnumSystemLocalesEx() in get_iso_localename().
955957
*
@@ -1088,8 +1090,11 @@ get_iso_localename(const char *winlocname)
10881090
return NULL;
10891091

10901092
/*
1091-
* Simply replace the hyphen with an underscore. See comments in
1092-
* IsoLocaleName.
1093+
* Since the message catalogs sit on a case-insensitive filesystem, we
1094+
* need not standardize letter case here. So long as we do not ship
1095+
* message catalogs for which it would matter, we also need not
1096+
* translate the script/variant portion, e.g. uz-Cyrl-UZ to
1097+
* uz_UZ@cyrillic. Simply replace the hyphen with an underscore.
10931098
*/
10941099
hyphen = strchr(iso_lc_messages, '-');
10951100
if (hyphen)
@@ -1103,7 +1108,6 @@ get_iso_localename(const char *winlocname)
11031108
static char *
11041109
IsoLocaleName(const char *winlocname)
11051110
{
1106-
#if defined(_MSC_VER)
11071111
static char iso_lc_messages[LOCALE_NAME_MAX_LENGTH];
11081112

11091113
if (pg_strcasecmp("c", winlocname) == 0 ||
@@ -1114,10 +1118,18 @@ IsoLocaleName(const char *winlocname)
11141118
}
11151119
else
11161120
return get_iso_localename(winlocname);
1121+
}
11171122

1118-
#endif /* defined(_MSC_VER) */
1119-
return NULL; /* Not supported on this version of msvc/mingw */
1123+
#else /* !defined(_MSC_VER) */
1124+
1125+
static char *
1126+
IsoLocaleName(const char *winlocname)
1127+
{
1128+
return NULL; /* Not supported on MinGW */
11201129
}
1130+
1131+
#endif /* defined(_MSC_VER) */
1132+
11211133
#endif /* WIN32 && LC_MESSAGES */
11221134

11231135

0 commit comments

Comments
 (0)