summaryrefslogtreecommitdiff
path: root/lang/ghc90/patches/patch-rts_ProfHeap.c
blob: 74429f4a9c15846c71ee8dde0eeac5fe830b4acc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$NetBSD: patch-rts_ProfHeap.c,v 1.5 2021/09/30 15:32:53 jperkin Exp $

NetBSD does not have uselocale(3).

Sent to the upstream:
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5677

--- rts/ProfHeap.c.orig	2021-01-25 16:30:28.000000000 +0000
+++ rts/ProfHeap.c
@@ -69,7 +69,7 @@ static locale_t prof_locale = 0, saved_l
 STATIC_INLINE void
 init_prof_locale( void )
 {
-#if !defined(mingw32_HOST_OS)
+#if !defined(mingw32_HOST_OS) && !defined(netbsd_HOST_OS)
     if (! prof_locale) {
         prof_locale = newlocale(LC_NUMERIC_MASK, "POSIX", 0);
         if (! prof_locale) {
@@ -83,7 +83,7 @@ init_prof_locale( void )
 STATIC_INLINE void
 free_prof_locale( void )
 {
-#if !defined(mingw32_HOST_OS)
+#if !defined(mingw32_HOST_OS) && !defined(netbsd_HOST_OS)
     if (prof_locale) {
         freelocale(prof_locale);
         prof_locale = 0;
@@ -98,6 +98,9 @@ set_prof_locale( void )
     prof_locale_per_thread = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
     saved_locale = setlocale(LC_NUMERIC, NULL);
     setlocale(LC_NUMERIC, "C");
+#elif defined(netbsd_HOST_OS)
+    saved_locale = setlocale(LC_NUMERIC, NULL);
+    setlocale(LC_NUMERIC, "C");
 #else
     saved_locale = uselocale(prof_locale);
 #endif
@@ -109,6 +112,8 @@ restore_locale( void )
 #if defined(mingw32_HOST_OS)
     _configthreadlocale(prof_locale_per_thread);
     setlocale(LC_NUMERIC, saved_locale);
+#elif defined(netbsd_HOST_OS)
+    setlocale(LC_NUMERIC, saved_locale);
 #else
     uselocale(saved_locale);
 #endif