+2024-06-05 Paul Eggert <eggert@cs.ucla.edu>
+
+ nstrftime: don’t assume <locale.h>
+ * lib/strftime.c: Include <locale.h> only if needed, since Emacs
+ attempts to be portable to platforms lacking <locale.h> so it
+ avoids localename-unsafe-limited and defines
+ REQUIRE_GNUISH_STRFTIME_AM_PM to false.
+
2024-06-05 Bruno Haible <bruno@clisp.org>
nstrftime: Make %c work on native Windows again.
#include <stdlib.h>
#include <string.h>
-#include <locale.h>
+#if (((defined __NetBSD__ || defined __sun) && REQUIRE_GNUISH_STRFTIME_AM_PM) \
+ || (defined _WIN32 && !defined __CYGWIN__) \
+ || (USE_C_LOCALE && HAVE_STRFTIME_L))
+# include <locale.h>
+#endif
+
#if (defined __NetBSD__ || defined __sun) && REQUIRE_GNUISH_STRFTIME_AM_PM
# include "localename.h"
#elif defined _WIN32 && !defined __CYGWIN__
#elif USE_C_LOCALE && !HAVE_STRFTIME_L
subfmt = L_("%I:%M:%S %p");
goto subformat;
-#elif (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || (defined _WIN32 && !defined __CYGWIN__)
+#elif ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ \
+ || (defined _WIN32 && !defined __CYGWIN__))
/* macOS, FreeBSD, native Windows strftime() may produce empty output
for "%r". */
subfmt = L_("%I:%M:%S %p");