CSTD=c99 breaks package creation
Tim Robbins
tjr at FreeBSD.ORG
Wed Jun 11 21:21:14 PDT 2003
On Wed, Jun 11, 2003 at 07:37:01PM -0700, Kris Kennaway wrote:
> It's possible that there's either a bug in gcc or there is C code in
> the system that has a different meaning when interpreted to C99
> standards.
I think I may have found the problem, and I think it's in GNU tar.
GNU tar does this:
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
#endif
machine/_types.h does this:
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
If __attribute__ is empty, __int64_t becomes a synonym for int. Bad.
Attached is a test program. Compile it w/o a -std option and see that the
output, which is sizeof(int64_t), is 8 as expected. Compile with -std=c99 and
see that sizeof(int64_t) is 4.
Tim
-------------- next part --------------
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
#endif
#include <sys/types.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
(void)__bswap64((uint64_t)3);
printf("%d\n", (int)sizeof(uint64_t));
exit(0);
}
More information about the freebsd-current
mailing list