bug#20819: [PATCH] i18n: check for non-POSIX strtol_l

2015-06-15 Thread Natanael Copa
* configure.ac: Check for strtol_l
* libguile/i18n.c: Check with HAVE_STRTOL_L before using strtol_l. This
  fixes build with musl libc.
---
 configure.ac| 5 +++--
 libguile/i18n.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 19e00d8..b73a0db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -752,6 +752,7 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
 #   isblank - available as a GNU extension or in C99
 #   _NSGetEnviron - Darwin specific
 #   strcoll_l, newlocale, uselocale, utimensat - POSIX.1-2008
+#   strtol_l - non-POSIX, found in glibc and BSD
 #   fork - unavailable on Windows
 #   sched_getaffinity, sched_setaffinity - GNU extensions (glibc)
 #   sendfile - non-POSIX, found in glibc
@@ -765,8 +766,8 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 
ctermid \
   strdup system usleep atexit on_exit chown link fcntl ttyname getpwent
\
   getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \
   index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron\
-  strcoll strcoll_l newlocale uselocale utimensat sched_getaffinity\
-  sched_setaffinity sendfile])
+  strcoll strcoll_l strtol_l newlocale uselocale utimensat \
+  sched_getaffinity sched_setaffinity sendfile])
 
 # Reasons for testing:
 #   netdb.h - not in mingw
diff --git a/libguile/i18n.c b/libguile/i18n.c
index f0e3443..17e9eca 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -1373,7 +1373,7 @@ SCM_DEFINE (scm_locale_string_to_integer, 
"locale-string->integer",
 
   if (c_locale != NULL)
 {
-#ifdef USE_GNU_LOCALE_API
+#if defined(USE_GNU_LOCALE_API) && defined(HAVE_STRTOL_L)
   c_result = strtol_l (c_str, &c_endptr, c_base, c_locale);
 #else
   RUN_IN_LOCALE_SECTION (c_locale,
-- 
2.4.3






bug#73835: Build failure with gcc 14 and musl on 32 bit

2024-10-16 Thread Natanael Copa
Hi,

I get this error message when compiling guile 3.0.9 and 3.0.10 with gcc
14 / musl libc on 32 bit Alpine Linux:

filesys.c: In function 'scm_sendfile':
filesys.c:1405:16: error: assignment to 'off_t *' {aka 'long long int *'} from 
incompatible pointer type 'scm_t_off *' {aka 'long int *'} 
[-Wincompatible-pointer-types]
 1405 | offset_ptr = SCM_UNBNDP (offset) ? NULL : &c_offset;
  |^

It looks like an assumption that off_t is 32 bit, which is not true on musl 
libc.

-nc





bug#73835: Build failure with gcc 14 and musl on 32 bit

2024-10-16 Thread Natanael Copa
On Wed, 16 Oct 2024 09:56:22 +0200
Natanael Copa  wrote:

> Hi,
> 
> I get this error message when compiling guile 3.0.9 and 3.0.10 with gcc
> 14 / musl libc on 32 bit Alpine Linux:
> 
> filesys.c: In function 'scm_sendfile':
> filesys.c:1405:16: error: assignment to 'off_t *' {aka 'long long int *'} 
> from incompatible pointer type 'scm_t_off *' {aka 'long int *'} 
> [-Wincompatible-pointer-types]
>  1405 | offset_ptr = SCM_UNBNDP (offset) ? NULL : &c_offset;
>   |^
> 
> It looks like an assumption that off_t is 32 bit, which is not true on musl 
> libc.
> 
> -nc

This appears to solve it:

diff --git a/libguile/filesys.c b/libguile/filesys.c
index 70a6ef6..0500d45 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1388,7 +1388,7 @@ SCM_DEFINE (scm_sendfile, "sendfile", 3, 1, 0,
 
   ssize_t result SCM_UNUSED;
   size_t c_count, total = 0;
-  scm_t_off c_offset;
+  off_t c_offset;
   int in_fd, out_fd;
 
   VALIDATE_FD_OR_PORT (out_fd, out, 1);