bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Joseph Maxwell
Subject: Re: va_copy error [Was Re: Make Problem - parse error before "const"]
Date: Mon, 05 May 2008 00:46:37 -0700
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

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  {
    48    va_list tmp_authors;
    49
    50    va_copy (tmp_authors, authors);
    51
    52    n_authors = 0;
    53    while (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.c        format.c      freeze.c      input.c       m4.c          m4.h          macro.c
Makefile      Makefile.am   Makefile.in   output.c      path.c        stackovf.c    symtab.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,
                const char *version, va_list authors)
{
  size_t n_authors;

  /* 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;
  }

  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 GPLv2+: GNU GPL version 2 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);

  switch (n_authors)
    {
    case 0:
      /* The caller must provide at least one author name.  */
      abort ();
    case 1:
      /* TRANSLATORS: %s denotes an author name.  */
      vfprintf (stream, _("Written by %s.\n"), authors);
      break;
    case 2:
      /* TRANSLATORS: Each %s denotes an author name.  */
      vfprintf (stream, _("Written by %s and %s.\n"), authors);
      break;
    case 3:
      /* TRANSLATORS: Each %s denotes an author name.  */
      vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
      break;
    case 4:
      /* TRANSLATORS: Each %s denotes an author name.
         You can use line breaks, estimating that each author name occupies
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
      vfprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors);
      break;

Thanks

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]