> gcc -I. -E gwlib/octstr.c  | grep -C format_width
I get the exact same output as you when I issue this command.

> gcc -I. -E gwlib/octstr.c  | grep -C "case 's'"
This is what I get:

        break;
 
    case 's':
        s = __extension__ (*({  register   char *  *__ptr;      if
((__builtin_classify_type(*(   char *   *)0) == 8)  && sizeof (  char *
)
< 16)   {       unsigned char __fpr = ( *args )->fpr;   if (__fpr < 8)
{       __ptr = ((    char *   *) (void *) (&(((__va_regsave_t *)   (
*args  )->reg_save_area)->__fp_save[  __fpr ]))) ;    ( *args )->fpr =
__fpr + 1;     }       else if (sizeof (  char * ) == 8)       {
unsigned long __addr = (unsigned long) ((  *args  )->overflow_arg_area
);        __ptr = (  char *  *)((__addr + 7) & -8);       (  *args
)->overflow_arg_area  = (char *)(__ptr + 1);       }       else    {
;      }       }       else if ((__builtin_classify_type(*(   char *
*)0) >= 12)  || (__builtin_classify_type(*(   char *   *)0) == 8) )  {
unsigned char __gpr = ( *args )->gpr;   if (__gpr < 8)  {   __ptr = * ((
char *  *  *) (void *) (&(((__va_regsave_t *)    (  *args
)->reg_save_area)->__gp_save[  __gpr ]))) ;   ( *args )->gpr = __gpr +
1;  }       else    {         char *  **__pptr = (  char *  **) ((
*args  )->overflow_arg_area );  __ptr = * __pptr;       (  *args
)->overflow_arg_area  = (char *) (__pptr + 1);     }       }       else
{       if (sizeof (  char * ) == 8)    {       unsigned char __gpr = (
*args )->gpr;        if (__gpr < 7)  {       __gpr += __gpr & 1;
__ptr = ((    char *   *) (void *) (&(((__va_regsave_t *)       (  *args
)->reg_save_area)->__gp_save[  __gpr ]))) ;        ( *args )->gpr =
__gpr + 2;     }       else    {       unsigned long __addr = (unsigned
long) ((  *args  )->overflow_arg_area ); __ptr = (  char *  *)((__addr +
7) & -8);  ( *args )->gpr = 8;     (  *args  )->overflow_arg_area  =
(char *)(__ptr + 1);       }       }       else if (sizeof (  char * )
== 4)       {       unsigned char __gpr = ( *args )->gpr;   if (__gpr <
8)       {       __ptr = ((    char *   *) (void *) (&(((__va_regsave_t
*)       (  *args  )->reg_save_area)->__gp_save[  __gpr ]))) ( *args
)->gpr = __gpr + 1;      }       else    {       __ptr = (  char *  *) (
*args  )->overflow_arg_area ;  (  *args  )->overflow_arg_area  = (char
*)(__ptr + 1);       }       }       else    {        ;      }       }
__ptr;  })) ;
        if (format->has_prec && format->prec < (long) strlen(s))

A lot more than you ;o)

Jacob

-----Original Message-----
From: Richard Braakman [mailto:[EMAIL PROTECTED]]
Sent: 11. december 2001 12:58
To: [EMAIL PROTECTED]
Subject: Re: AW: Kannel on PPC


On Tue, Dec 11, 2001 at 11:47:40AM +0100, Jacob Vennervald Madsen wrote:
> I get these warnings at compile time:
> 
> gwlib/octstr.c: In function `octstr_format_valist':
> gwlib/octstr.c:1985: warning: passing arg 3 of `format_width' from
> incompatible pointer type
> gwlib/octstr.c:1986: warning: passing arg 3 of `format_prec' from
> incompatible pointer type
> gwlib/octstr.c:1988: warning: passing arg 4 of `convert' from
> incompatible pointer type

Interesting... arg 3 is the va_list pointer.  If va_list were a real
type
(builtin or typedefed), then this could not happen, because
format_width()
takes a "va_list *" and the caller passes the address of a va_list.
But it might be that va_list is a macro on your system, such that
writing
"va_list *" does not work as expected.

I think this command could shed some light on the problem:
gcc -I. -E gwlib/octstr.c  | grep -C format_width
(run it from the main kannel directory, i.e. with gwlib as a
subdirectory).

This will expand all preprocessor macros and show the result.
On my system, it gives:



static void format_width(struct format *format, const char **fmt,
                         va_list *args)
{
--
        ++fmt;
        format_flags(&format, &fmt);
        format_width(&format, &fmt, &args);
        format_prec(&format, &fmt, &args);
        format_type(&format, &fmt);


This shows that va_list is a type of its own, and not a macro.  If it
shows
something else on your system, then that would be a clue towards solving
this problem.

Oh, a similar grep might help by showing what va_arg gets expanded to:

gcc -I. -E gwlib/octstr.c  | grep -C "case 's'"

shows:

        break;

    case 's':
        s = ( *args  = (__gnuc_va_list) ((char *) ( *args ) + (((sizeof
(   char *  ) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ),
*((  char *  *) (void *) ((char *) ( *args ) - (((sizeof (   char *  ) +
sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ))) ;

(I'm beginning to suspect that the solution might be as simple as
writing
"(*args)" instead of "*args" in the va_arg calls.)

By the way, I'm not really back, I'm just kibitzing and I like puzzling
out interesting C problems :)

Richard Braakman


Reply via email to