Subject: types gone amuck (Re: CVS commit: basesrc/bin/pax)
To: Luke Mewburn <lukem@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 10/27/2001 08:11:12
hi,

this doesn't compile on sparc64.  the error is:

/build/src/bin/pax/ar_io.c: In function `timefmt':
/build/src/bin/pax/ar_io.c:1403: warning: long long unsigned int format, long unsigned int arg (arg 5)
/build/src/bin/pax/ar_io.c: In function `sizefmt':
/build/src/bin/pax/ar_io.c:1413: warning: long long unsigned int format, long unsigned int arg (arg 4)


the code in question is:

	(void)snprintf(buf, size, "%lu secs (" OFFT_F " bytes/sec)",
	    (unsigned long)tm, (OFFT_T)(sz / tm));

where we have:

#define	OFFT_F			"%llu"
#define	OFFT_T			u_longlong_t


the reason this is a problem is:
/build/destdir/usr/include/sys/types.h:typedef  u_quad_t        u_longlong_t;   /* ANSI unsigned long long type */
/build/destdir/usr/include/sys/types.h:typedef  u_int64_t       u_quad_t;       /* quads */
/build/destdir/usr/include/sys/types.h:typedef  uint64_t        u_int64_t;
/build/destdir/usr/include/sys/types.h:typedef  __uint64_t      uint64_t;

and then in the sparc64 machine/types.h:

#ifdef __arch64__
/* 64-bit compiler */
typedef long int                __int64_t;
typedef unsigned long int      __uint64_t;
#else
/* 32-bit compiler */
/* LONGLONG */
typedef long long int           __int64_t;
/* LONGLONG */
typedef unsigned long long int __uint64_t;
#endif


so the way things are right now, we can't assume that "u_longlong_t"
is equivalent to "unsigned long long".  so the question is:
is "u_longlong_t" just supposed to be an unsigned 64-bit type,
or is it supposed to be equivalent to "unsigned long long"?

-Chuck


On Thu, Oct 25, 2001 at 08:33:35AM +0300, Luke Mewburn wrote:
> 
> Module Name:	basesrc
> Committed By:	lukem
> Date:		Thu Oct 25 05:33:34 UTC 2001
> 
> Modified Files:
> 	basesrc/bin/pax: Makefile ar_io.c ar_subs.c buf_subs.c cpio.c extern.h
> 	    file_subs.c ftree.c gen_subs.c getoldopt.c options.c pat_rep.c
> 	    pax.c pax.h sel_subs.c tables.c tar.c tty_subs.c
> 
> Log Message:
> - ansi KNF (just remove all the #ifndef __STDC__ prototype junk,
>   leaving the ansi stuff)
> - use longlong_t instead of quad_t (etc), and rename *uqd*() -> *ull*()
> - clean up the NET2_STAT stuff similar to ftpd; provide #defines and
>   macros which select which cast to use, etc
> - clean up the NET2_FTS and NET2_REGEX #define use
> 
> 
> To generate a diff of this commit:
> cvs rdiff -r1.10 -r1.11 basesrc/bin/pax/Makefile basesrc/bin/pax/cpio.c \
>     basesrc/bin/pax/ftree.c basesrc/bin/pax/getoldopt.c basesrc/bin/pax/pax.h
> cvs rdiff -r1.19 -r1.20 basesrc/bin/pax/ar_io.c basesrc/bin/pax/file_subs.c
> cvs rdiff -r1.14 -r1.15 basesrc/bin/pax/ar_subs.c basesrc/bin/pax/tables.c
> cvs rdiff -r1.15 -r1.16 basesrc/bin/pax/buf_subs.c
> cvs rdiff -r1.25 -r1.26 basesrc/bin/pax/extern.h
> cvs rdiff -r1.20 -r1.21 basesrc/bin/pax/gen_subs.c
> cvs rdiff -r1.32 -r1.33 basesrc/bin/pax/options.c
> cvs rdiff -r1.11 -r1.12 basesrc/bin/pax/pat_rep.c
> cvs rdiff -r1.13 -r1.14 basesrc/bin/pax/pax.c
> cvs rdiff -r1.12 -r1.13 basesrc/bin/pax/sel_subs.c
> cvs rdiff -r1.18 -r1.19 basesrc/bin/pax/tar.c
> cvs rdiff -r1.9 -r1.10 basesrc/bin/pax/tty_subs.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.