Re: va_copy error [Was Re: Make Problem - parse error before const]

2008-05-05 Thread Joseph Maxwell

Gary V. Vaughan wrote:

Hi Joseph,

On 4 May 2008, at 14:18, Joseph Maxwell wrote:


gcc  -I. -g -O2 -MT version-etc.o -MD -MP -MF
.deps/version-etc.Tpo -c -o version-etc.o version-etc.c
version-etc.c: In function `version_etc_va':
version-etc.c:53: error: parse error before const
version-etc.c:53: error: parse error before const
version-etc.c:53: error: parse error before const
version-etc.c:53: error: parse error before const
version-etc.c:53: error: parse error before const
version-etc.c:53: error: parse error before ')' token
gmake[3]: *** [version-etc.o] Error 1
gmake[3]: Leaving directory `/usr/local/appl/gnu/m4/m4-1.4.11/lib'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/usr/local/appl/gnu/m4/m4-1.4.11/lib'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/local/appl/gnu/m4/m4-1.4.11'
gmake: *** [all] Error 2

=

could you advise


] cat -n src/version-etc.c | sed '47,55p;d'
47  {
48va_list tmp_authors;
49
50va_copy (tmp_authors, authors);
51
52n_authors = 0;
53while (va_arg (tmp_authors, const char *) != NULL)
54  ++n_authors;
55  }


Contents of my src directory
% ls /usr/local/appl/gnu/m4/m4-1.4.9/src/
builtin.c debug.c   eval.cformat.c  freeze.c  
input.c   m4.c  m4.h  macro.c
Makefile  Makefile.am   Makefile.in   output.c  path.c
stackovf.csymtab.c  ./.deps/

../

% version-etc.c found in
/usr/local/appl/gnu/m4/m4-1.4.11/lib/version-etc.c

% sed -n 47,56p version-etc.c
 /* Count the number of authors.  */
 {
   va_list tmp_authors;

   va_copy (tmp_authors, authors);

   n_authors = 0;
   while (va_arg (tmp_authors, const char *) != NULL)
 ++n_authors;
 }

IRIX version
% uname -R
6.5 6.5.22f

gcc version
% gcc -v
Reading specs from /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.3/specs
Configured with: ../configure --prefix=/usr/freeware 
--enable-version-specific-runtime-libs --disable-shared --enable-threads 
--enable-haifa --enable-libgcj --disable-c-mbchar

Thread model: single
gcc version 3.3


Probably, I should update gcc also, perhaps you can advise on any 
specific configuration to enable / disable etc.



It seems your system doesn't have a working va_arg macro.  What 
version of irix are you using?  What version of gcc are you using? 
m4-1.4.11 builds and passes all tests for me with both sgi's compiler 
and my gcc-4.2.3 installation:


 ] ./config.guess
 mips-sgi-irix6.5
 ] /bin/cc -v
 MIPSpro Compilers: Version 7.4.4m
 ] ./configure CC='/bin/cc'
 ...
 ] make all check
 ...
 ===
 All 47 tests passed
 ===
 ...
 Skipped checks were:
   ./109.changeword ./110.changeword ./111.changeword ./112.changeword 
./113.changeword ./114.changeword

 All checks successful
 ] make clean
 ...
 ] /opt/gnu/gcc423/bin/gcc --version
 gcc (GCC) 4.2.3
 Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There 
is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.
 
 ] ./configure CC='/opt/gnu/gcc42/bin/gcc'

 ...
 ] make all check
 ...
 ===
 All 47 tests passed
 ===
 ...
 Skipped checks were:
   ./109.changeword ./110.changeword ./111.changeword ./112.changeword 
./113.changeword ./114.changeword

 All checks successful

Maybe your gcc is not installed correctly?

However, since m4-1.4.11 has 3 authors, you could work around it by 
rewriting the version_etc function to accept author names explicitly:


void  
version_etc (FILE *stream,

 const char *command_name, const char *package,
 const char *version, const char *author1, const char 
*author2,

 const char *author3, const char *ignored)
{
  if (command_name)
fprintf (stream, %s (%s) %s\n, command_name, package, version);
  else
fprintf (stream, %s %s\n, package, version);

  /* TRANSLATORS: Translate (C) to the copyright symbol
 (C-in-a-circle), if this symbol is available in the user's
 locale.  Otherwise, do not translate (C); leave it as-is.  */
  fprintf (stream, version_etc_copyright, _((C)), COPYRIGHT_YEAR);

  fputs (_(\
\n\
License GPLv3+: GNU GPL version 3 or later 
http://gnu.org/licenses/gpl.html\n\

This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n\
\n\
),
 stream);

  /* TRANSLATORS: Each %s denotes an author name.  */
  fprintf (stream, _(Written by %s, %s, and %s.\n), author1, 
author2, author3);
} 

The code in my source is a tad bit different and my C isn't fully up to 
snuff. On which line should the explicit authors field be filled


   void
   version_etc_va (FILE *stream,
   const char *command_name, const char *package,
   

Re: tests/test-getaddrinfo.c: compile failures on freebsd 6

2008-05-05 Thread Simon Josefsson
Jim Meyering [EMAIL PROTECTED] writes:

 However, now that I've learned more about it, I see there's a
 better way.  EAI_NONAME seems to be preferred: EAI_NODATA isn't
 even mentioned in the POSIX specs I looked at.
...
 EAI_NODATA is no longer even mentioned in RFC3493.
 Since at least FreeBSD has removed it in favour of EAI_NONAME,
 how about defining it to EAI_NONAME if it is not defined?

Hi Jim.  Yes, indeed, EAI_NODATA seems to be historic.

   handle undefined EAI_NODATA better
   * lib/getaddrinfo.h [!defined EAI_NODATA  defined EAI_NONAME]
   (EAI_NODATA): Define.
   * tests/test-getaddrinfo.c (EAI_NODATA): Don't define here.
   This also reverts c9a6a9bb007294bb8878d685f3e9336b3a5be1ed.

   test-getaddrinfo.c: include netinet/in.h
   * tests/test-getaddrinfo.c: This is required for the new use
   of struct sockaddr_in, at least on FreeBSD 6.

Looks fine to me, please push it!

Thanks,
Simon

 diff --git a/lib/getaddrinfo.h b/lib/getaddrinfo.h
 index b4ef242..0e9aec1 100644
 --- a/lib/getaddrinfo.h
 +++ b/lib/getaddrinfo.h
 @@ -84,6 +84,14 @@ struct addrinfo
  # define EAI_SERVICE   -8/* SERVICE not supported for `ai_socktype'.  */
  # define EAI_MEMORY-10   /* Memory allocation failure.  */
  #endif
 +
 +/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
 +   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
 +   in favor of EAI_NONAME.  */
 +#if !defined EAI_NODATA  defined EAI_NONAME
 +# define EAI_NODATA EAI_NONAME
 +#endif
 +
  #ifndef EAI_OVERFLOW
  /* Not defined on mingw32. */
  # define EAI_OVERFLOW  -12   /* Argument buffer overflow.  */
 diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
 index 801bae8..8d487cb 100644
 --- a/tests/test-getaddrinfo.c
 +++ b/tests/test-getaddrinfo.c
 @@ -32,10 +32,6 @@
  # define EAI_SERVICE 0
  #endif

 -#ifndef EAI_NODATA
 -# define EAI_NODATA 0
 -#endif
 -
  int simple (char *host, char *service)
  {
char buf[BUFSIZ];


 diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
 index 8d487cb..530f8dc 100644
 --- a/tests/test-getaddrinfo.c
 +++ b/tests/test-getaddrinfo.c
 @@ -20,6 +20,7 @@
  #include config.h
  #include getaddrinfo.h
  #include arpa/inet.h
 +#include netinet/in.h
  #include stdio.h
  #include string.h

 --
 1.5.5.1.117.ga349




Re: va_copy error [Was Re: Make Problem - parse error before const]

2008-05-05 Thread Gary V. Vaughan

Hi Joseph,

Your OS is older than the one I'm testing on, but I still think your
gcc installation is not quite right somehow.  Have you tried compiling
with the SGI compiler?

On 5 May 2008, at 03:46, Joseph Maxwell wrote:

% gcc -v
Reading specs from /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.3/ 
specs
Configured with: ../configure --prefix=/usr/freeware --enable- 
version-specific-runtime-libs --disable-shared --enable-threads -- 
enable-haifa --enable-libgcj --disable-c-mbchar

Thread model: single
gcc version 3.3


Probably, I should update gcc also, perhaps you can advise on any  
specific configuration to enable / disable etc.



Here's what I see:

% /opt/gnu/gcc423/bin/gcc -v
Reading specs from /opt/gnu/gcc423/lib/gcc/mips-sgi-irix6.5/4.2.3/specs
Target: mips-sgi-irix6.5
Configured with: /opt/build/gcc-4.2.3/configure --with-included- 
gettext --enable-shared --with-gnu-as --with-as=/opt/gnu/gcc423/mips- 
sgi-irix6.5/bin/as --with-gmp=/opt/gnu/libgmp42 --with-gmp-ldflags=- 
Wl,-rpath,/opt/gnu/libgmp42/lib --enable-languages=c,c++,fortran -- 
datadir=/opt/gnu/gcc423/share --with-x --with-local-prefix=/opt/gnu/ 
gcc423 --with-gxx-include-dir=/opt/gnu/gcc423/include/c++ --prefix=/ 
opt/gnu/gcc423

Thread model: single
gcc version 4.2.3

HTH

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_






PGP.sig
Description: This is a digitally signed message part