Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Apr 2002 03:12:41 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        obrien@FreeBSD.ORG
Cc:        sparc64@FreeBSD.ORG
Subject:   Re: hosted-gcc_20020419.tar.bz2 uploaded
Message-ID:  <p05111711b8ed53026dff@[128.113.24.47]>
In-Reply-To: <20020424192940.B35128@dragon.nuxi.com>
References:  <20020420194116.A92671@dragon.nuxi.com> <p05111703b8ea1ccbbd40@[128.113.24.47]> <20020422135153.A50570@dragon.nuxi.com> <p05111700b8ea33d21f0a@[128.113.24.47]> <20020424192940.B35128@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 7:29 PM -0700 4/24/02, David O'Brien wrote:
>On Mon, Apr 22, 2002 at 05:58:56PM -0400, Garance A Drosihn wrote:
>>  |_  ../ctlinfo.c:231: warning: void format, cjobinfo arg (arg 3)
>>  |_  ../ctlinfo.c:231: warning: void format, cjprivate arg (arg 4)
>  >
>  > If I cast those parameters to (void *) then the warning
>  > goes away.  Is that a change I should make?
>
>Yes.

Okay, Will do.

>  > |_  ../net.c:278: warning: pointer of type `void *' used in arithmetic
>>
>>  Should va_arg() be changed?
>
>You (the port) may not be using the proper va_args header.

 From SUSv2, the only header required is stdarg.h.
Here's a sample program to try:

  = = = begin = = =
/*
  *  Gets warnings under sparc64 if compiled via:
  *       cc -pedantic       -c check_varg.c
  *  or   cc -Wpointer-arith -c check_varg.c
  *
  *  Will not get warnings if you change the type of 'ap'
  *  from 'va_list' to 'char *'.
  */

#include <stdarg.h>

int sample(int strm, ...);

int
sample(int strm, ...)
{
	va_list ap;

	va_start(ap, strm);
	va_arg(ap, char *);

	return (0);
}

  = = = end = = =

Some interesting code is in /usr/include/machine/ansi.h:

#if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 95)
#define _BSD_VA_LIST_   __builtin_va_list       /* internally known to gcc */
#else
#define _BSD_VA_LIST_   char *                  /* va_list */
#endif /* post GCC 2.95 */
#ifdef __GNUC__
typedef _BSD_VA_LIST_ __gnuc_va_list;           /* compatibility 
w/GNU headers*/
#endif

The sample program will also compile without warnings if you
modify ansi.h by adding the lines:

#undef _BSD_VA_LIST_
#define _BSD_VA_LIST_   char *

after the above section.

I was already dropping -pedantic from my compiles, should I
just drop -Wpointer-arith too?  It looks bsd.sys.mk still
includes that if ${WARNS} > 2, so I assume it's still a
useful option to specify.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05111711b8ed53026dff>