[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fpurge.c, freadahead.c, freading.c make wrong assumption
From: |
Bruno Haible |
Subject: |
Re: fpurge.c, freadahead.c, freading.c make wrong assumption |
Date: |
Tue, 8 Apr 2008 13:13:18 +0200 |
User-agent: |
KMail/1.5.4 |
Brian K. White wrote:
> I am hitting the same thing.
>
> I was only able to build gnu m4 1.4.11 by doing this:
>
> CONFIG_SHELL=/usr/bin/bash /usr/bin/bash ./configure --disable-largefile
> CONFIG_SHELL=/usr/bin/bash CFLAGS="-D_ptr=__ptr -D_base=__base -D_cnt=__cnt
> -D_flag=__flag"
>
> The bash weirdness came out of /usr/local/src/m4-1.4.11/INSTALL, and was the
> only way to get ./configure to run at all. Otherwise even just "./configure
> --help" failed with configure: 942: : is not an identifier" Line number is
> just an example. Several (but not most) apps ./configure had the same
> problem, but it no longer fails on any app after installing the new m4. But
> in each case, though the line number differed the line was always this one:
> ac_subst_files='' which looks harmless but always comes right after a very
> large list being set in another variable.
>
> Also, for reference, My gcc defines are somewhat different on a nominaly
> similar system. Open Server 5.0.7 with the most recent (old as it is)
> vendor-built gcc, 2.95 from gnutools5.0.7Kj.
>
> gcc -E -dM empty.c |sort
> #define M_I386 1
> #define M_UNIX 1
> #define M_XENIX 1
> #define _M_BITFIELDS 1
> #define _M_I386 1
> #define _M_I86 1
> #define _M_I86SM 1
> #define _M_INTERNAT 1
> #define _M_SDATA 1
> #define _M_STEXT 1
> #define _M_SYS5 1
> #define _M_SYSIII 1
> #define _M_SYSV 1
> #define _M_UNIX 1
> #define _M_WORDSWAP 1
> #define _M_XENIX 1
> #define _SCO_C_DIALECT 1
> #define _SCO_DS 1
> #define _SCO_ELF 1
> #define _SCO_XPG_VERS 4
> #define _STRICT_NAMES 1
> #define __GNUC_MINOR__ 95
> #define __GNUC__ 2
> #define __i386 1
> #define __i386__ 1
> #define __i586 1
> #define __i586__ 1
> #define __pentium 1
> #define __pentium__ 1
> #define __unix 1
> #define i386 1
> #define i586 1
> #define pentium 1
> #define unix 1
Thanks for reporting this. So we now have two platforms which need the
same treatment (use __base instead of _base etc.):
OpenServer 5:
#define _SCO_DS 1
#define _SCO_XPG_VERS 4
#define _M_UNIX 1
#define _M_XENIX 1
OpenServer 6:
#define _SCO_DS 2
#define _SCO_DS_LL 1
#define __OPENSERVER6__ 1
#define __UNIXWARE__ 1
The common macro to test for, here, is apparently _SCO_DS.
(See also http://de.wikipedia.org/wiki/SCO_Unix and
http://de.wikipedia.org/wiki/UnixWare.)
I'm applying this patch. Please test it by running "make" and "make check"
in a tarball created with "gnulib-tool --create-testdir --with-tests ..."
2008-04-08 Bruno Haible <address@hidden>
Add tentative support for OpenServer.
* lib/fbufmode.c (fbufmode): Add conditional define for _flag, _base,
_ptr, _cnt.
* lib/fpurge.c (fpurge): Likewise.
* lib/freadable.c (freadable): Likewise.
* lib/freadahead.c (freadahead): Likewise.
* lib/freading.c (freading): Likewise.
* lib/freadptr.c (freadptr): Likewise.
* lib/freadseek.c (freadptrinc): Likewise.
* lib/fseeko.c (rpl_fseeko): Likewise.
* lib/fseterr.c (fseterr): Likewise.
* lib/fwritable.c (fwritable): Likewise.
* lib/fwriting.c (fwriting): Likewise.
Reported by Roger Cornelius <address@hidden> and
Brian K. White <address@hidden>.
*** lib/fbufmode.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fbufmode.c 2008-04-08 13:04:37.000000000 +0200
***************
*** 1,5 ****
/* Retrieve information about a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Retrieve information about a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 46,52 ****
if (fp->_flags & __SNBF)
return _IONBF;
return _IOFBF;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if HAVE___FLBF /* Solaris >= 7 */
if (__flbf (fp))
return _IOLBF;
--- 46,52 ----
if (fp->_flags & __SNBF)
return _IONBF;
return _IOFBF;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if HAVE___FLBF /* Solaris >= 7 */
if (__flbf (fp))
return _IOLBF;
***************
*** 64,69 ****
--- 64,72 ----
} *) fp)
return fp_->_flag & (_IONBF | _IOFBF);
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _flag __flag
+ # endif
if (fp->_flag & _IONBF)
return _IONBF;
return _IOFBF;
*** lib/fpurge.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fpurge.c 2008-04-08 13:04:44.000000000 +0200
***************
*** 1,5 ****
/* Flushing buffers of a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Flushing buffers of a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 90,96 ****
fp_ub._base = NULL;
}
return 0;
! # elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
fp->_ptr = fp->_base;
if (fp->_ptr != NULL)
fp->_cnt = 0;
--- 90,101 ----
fp_ub._base = NULL;
}
return 0;
! # elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _base __base
! # define _ptr __ptr
! # define _cnt __cnt
! # endif
fp->_ptr = fp->_base;
if (fp->_ptr != NULL)
fp->_cnt = 0;
*** lib/freadable.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/freadable.c 2008-04-08 13:04:48.000000000 +0200
***************
*** 1,5 ****
/* Retrieve information about a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Retrieve information about a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 29,35 ****
return (fp->_flags & _IO_NO_READS) == 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & (__SRW | __SRD)) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & (_IORW | _IOREAD)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_Mode & 0x1 /* _MOPENR */) != 0;
--- 29,38 ----
return (fp->_flags & _IO_NO_READS) == 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & (__SRW | __SRD)) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _flag __flag
! # endif
return (fp->_flag & (_IORW | _IOREAD)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_Mode & 0x1 /* _MOPENR */) != 0;
*** lib/freadahead.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/freadahead.c 2008-04-08 13:05:02.000000000 +0200
***************
*** 43,49 ****
return 0;
return fp->_r
+ (HASUB (fp) ? fp->_ur : 0);
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
--- 43,49 ----
return 0;
return fp->_r
+ (HASUB (fp) ? fp->_ur : 0);
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
***************
*** 56,61 ****
--- 56,65 ----
return 0;
return fp_->_cnt;
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _flag __flag
+ # define _cnt __cnt
+ # endif
if ((fp->_flag & _IOWRT) != 0)
return 0;
return fp->_cnt;
*** lib/freading.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/freading.c 2008-04-08 13:04:54.000000000 +0200
***************
*** 1,5 ****
/* Retrieve information about a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Retrieve information about a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 35,41 ****
&& fp->_IO_read_base != NULL));
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & __SRD) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & _IOREAD) != 0;
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
--- 35,44 ----
&& fp->_IO_read_base != NULL));
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & __SRD) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _flag __flag
! # endif
return (fp->_flag & _IOREAD) != 0;
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
*** lib/freadptr.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/freadptr.c 2008-04-08 13:05:05.000000000 +0200
***************
*** 41,47 ****
return NULL;
*sizep = size;
return (const char *) fp->_p;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
--- 41,47 ----
return NULL;
*sizep = size;
return (const char *) fp->_p;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
***************
*** 58,63 ****
--- 58,68 ----
*sizep = size;
return (const char *) fp_->_ptr;
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _flag __flag
+ # define _ptr __ptr
+ # define _cnt __cnt
+ # endif
if ((fp->_flag & _IOWRT) != 0)
return NULL;
size = fp->_cnt;
*** lib/freadseek.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/freadseek.c 2008-04-08 13:05:08.000000000 +0200
***************
*** 37,43 ****
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
fp->_p += increment;
fp->_r -= increment;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
--- 37,43 ----
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
fp->_p += increment;
fp->_r -= increment;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
***************
*** 49,54 ****
--- 49,58 ----
fp_->_ptr += increment;
fp_->_cnt -= increment;
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _ptr __ptr
+ # define _cnt __cnt
+ # endif
fp->_ptr += increment;
fp->_cnt -= increment;
# endif
*** lib/fseeko.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fseeko.c 2008-04-08 13:05:13.000000000 +0200
***************
*** 1,5 ****
/* An fseeko() function that, together with fflush(), is POSIX compliant.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* An fseeko() function that, together with fflush(), is POSIX compliant.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 70,76 ****
? fp->_bf._size
: 0)
&& fp_ub._base == NULL)
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
--- 70,76 ----
? fp->_bf._size
: 0)
&& fp_ub._base == NULL)
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
***************
*** 82,87 ****
--- 82,92 ----
if (fp_->_ptr == fp_->_base
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _base __base
+ # define _ptr __ptr
+ # define _cnt __cnt
+ # endif
if (fp->_ptr == fp->_base
&& (fp->_ptr == NULL || fp->_cnt == 0))
# endif
***************
*** 112,118 ****
fp->_offset = pos;
fp->_flags |= __SOFF;
fp->_flags &= ~__SEOF;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
fp->_flag &= ~_IOEOF;
#endif
return 0;
--- 117,126 ----
fp->_offset = pos;
fp->_flags |= __SOFF;
fp->_flags &= ~__SEOF;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _flag __flag
! # endif
fp->_flag &= ~_IOEOF;
#endif
return 0;
*** lib/fseterr.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fseterr.c 2008-04-08 13:04:41.000000000 +0200
***************
*** 1,5 ****
/* Set the error indicator of a stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Set the error indicator of a stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 31,37 ****
fp->_flags |= _IO_ERR_SEEN;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
fp->_flags |= __SERR;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
--- 31,37 ----
fp->_flags |= _IO_ERR_SEEN;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
fp->_flags |= __SERR;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
***************
*** 42,47 ****
--- 42,50 ----
} *) fp)
fp_->_flag |= _IOERR;
# else
+ # if defined _SCO_DS /* OpenServer */
+ # define _flag __flag
+ # endif
fp->_flag |= _IOERR;
# endif
#elif defined __UCLIBC__ /* uClibc */
*** lib/fwritable.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fwritable.c 2008-04-08 13:04:51.000000000 +0200
***************
*** 1,5 ****
/* Retrieve information about a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Retrieve information about a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 29,35 ****
return (fp->_flags & _IO_NO_WRITES) == 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & (__SRW | __SWR)) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & (_IORW | _IOWRT)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_Mode & 0x2 /* _MOPENW */) != 0;
--- 29,38 ----
return (fp->_flags & _IO_NO_WRITES) == 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & (__SRW | __SWR)) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _flag __flag
! # endif
return (fp->_flag & (_IORW | _IOWRT)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_Mode & 0x2 /* _MOPENW */) != 0;
*** lib/fwriting.c.orig 2008-04-08 13:06:37.000000000 +0200
--- lib/fwriting.c 2008-04-08 13:04:57.000000000 +0200
***************
*** 1,5 ****
/* Retrieve information about a FILE stream.
! Copyright (C) 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,5 ----
/* Retrieve information about a FILE stream.
! Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 29,35 ****
return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & __SWR) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
mingw */
return (fp->_flag & _IOWRT) != 0;
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & __FLAG_WRITING) != 0;
--- 29,38 ----
return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0;
#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X,
Cygwin */
return (fp->_flags & __SWR) != 0;
! #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris,
OpenServer, mingw */
! # if defined _SCO_DS /* OpenServer */
! # define _flag __flag
! # endif
return (fp->_flag & _IOWRT) != 0;
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & __FLAG_WRITING) != 0;