bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] C++ support (3)


From: Bruno Haible
Subject: Re: [bug-gnulib] C++ support (3)
Date: Wed, 1 Nov 2006 21:27:42 +0100
User-agent: KMail/1.9.1

Eric Blake wrote:

> I'm trying that idea (using CC=g++ on Linux) on M4 before releasing m4 1.4.8. 
>  
> Is it worth fixing the vasnprintf module?
> 
> g++  -I.     -g -O2 -MT printf-parse.o -MD -MP -MF .deps/printf-parse.Tpo -c 
> -o 
> printf-parse.o printf-parse.c
> printf-parse.c: In function `int printf_parse(const char*, char_directives*, 
> arguments*)':
> printf-parse.c:71: error: invalid conversion from `void*' to `char_directive*'
> printf-parse.c:231: error: invalid conversion from `void*' to `argument*'
> printf-parse.c:289: error: invalid conversion from `void*' to `argument*'
> printf-parse.c:501: error: invalid conversion from `void*' to `argument*'
> printf-parse.c:518: error: invalid conversion from `void*' to 
> `char_directive*'
> make[2]: *** [printf-parse.o] Error 1

Yes. I'm applying this patch. This is simpler than adding #ifdefs that would
ensure that lib/printf-parse.c is not compiled on glibc systems.

For regex, however, I'd say the simplest is to provide a
--without-included-regex option that allows to you bypass the K&R C
declarations in lib/regex* that Ulrich Drepper refuses to convert to ANSI C.
Such a solution would also help Sam Steingold, who has the same problem in
GNU clisp.


2006-11-01  Bruno Haible  <address@hidden>

        * lib/printf-parse.c (PRINTF_PARSE): Cast malloc/realloc results.

*** lib/printf-parse.c  11 Oct 2006 16:09:38 -0000      1.8
--- lib/printf-parse.c  1 Nov 2006 20:24:41 -0000
***************
*** 68,74 ****
  
    d->count = 0;
    d_allocated = 1;
!   d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
    if (d->dir == NULL)
      /* Out of memory.  */
      return -1;
--- 68,74 ----
  
    d->count = 0;
    d_allocated = 1;
!   d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
    if (d->dir == NULL)
      /* Out of memory.  */
      return -1;
***************
*** 92,100 ****
        if (size_overflow_p (memory_size))                              \
          /* Overflow, would lead to out of memory.  */                 \
          goto error;                                                   \
!       memory = (a->arg                                                \
!                 ? realloc (a->arg, memory_size)                       \
!                 : malloc (memory_size));                              \
        if (memory == NULL)                                             \
          /* Out of memory.  */                                         \
          goto error;                                                   \
--- 92,100 ----
        if (size_overflow_p (memory_size))                              \
          /* Overflow, would lead to out of memory.  */                 \
          goto error;                                                   \
!       memory = (argument *) (a->arg                                   \
!                              ? realloc (a->arg, memory_size)          \
!                              : malloc (memory_size));                 \
        if (memory == NULL)                                             \
          /* Out of memory.  */                                         \
          goto error;                                                   \
***************
*** 515,521 ****
              if (size_overflow_p (memory_size))
                /* Overflow, would lead to out of memory.  */
                goto error;
!             memory = realloc (d->dir, memory_size);
              if (memory == NULL)
                /* Out of memory.  */
                goto error;
--- 515,521 ----
              if (size_overflow_p (memory_size))
                /* Overflow, would lead to out of memory.  */
                goto error;
!             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
              if (memory == NULL)
                /* Out of memory.  */
                goto error;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]