Gary V. Vaughan | 5 May 2008 04:34
Picon

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

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  }

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);
}     

Cheers,
Gary
-- 
  ())_.              Email me: gary <at> gnu.org
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ 


Eric Blake | 5 May 2008 16:35
Gravatar

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

Gary V. Vaughan <necro.no <at> mac.com> writes:

> 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:

Huh?

$ m4-1.4.11 --version | tail -n1
Written by Rene' Seindal.

But your comments about rewriting version_etc, taking one explicit author 
instead of three, might work.  However, there are other uses of va_arg in the 
m4 source, so I'm not sure that a rewrite would help.  It would be interesting 
to see version-etc.c after pre-processing.

--

-- 
Eric Blake

Gary V. Vaughan | 6 May 2008 01:09
Picon

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

On 5 May 2008, at 10:35, Eric Blake wrote:
> Gary V. Vaughan <necro.no <at> mac.com> writes:
>
>> 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:
>
> Huh?
>
> $ m4-1.4.11 --version | tail -n1
> Written by Rene' Seindal.

Oops.  Looking in the wrong directory.  *blush*

> But your comments about rewriting version_etc, taking one explicit  
> author
> instead of three, might work.  However, there are other uses of  
> va_arg in the
> m4 source, so I'm not sure that a rewrite would help.

Indeed.  I didn't bother to check whether the other instances could be
"unrolled" by hand too.  Quite right that papering over the cracks  
probabl
won't work here though.

>  It would be interesting
> to see version-etc.c after pre-processing.

Yes indeed!  Joseph please attach version-etc.pp.gz as generated by the
following to your next reply:

$ cd src
$ gcc  -I. -E version-etc.c | gzip -c > version-etc.pp.gz

Cheers,
	Gary
--

-- 
   ())_.              Email me: gary <at> gnu.org
   ( '/           Read my blog: http://blog.azazil.net
   / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_

Joseph Maxwell | 6 May 2008 01:40

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

Gary V. Vaughan wrote:
> On 5 May 2008, at 10:35, Eric Blake wrote:
>> Gary V. Vaughan <necro.no <at> mac.com> writes:
>>
>>> 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:
>>
>> Huh?
>>
>> $ m4-1.4.11 --version | tail -n1
>> Written by Rene' Seindal.
>
> Oops.  Looking in the wrong directory.  *blush*
>
>> But your comments about rewriting version_etc, taking one explicit 
>> author
>> instead of three, might work.  However, there are other uses of 
>> va_arg in the
>> m4 source, so I'm not sure that a rewrite would help.
>
> Indeed.  I didn't bother to check whether the other instances could be
> "unrolled" by hand too.  Quite right that papering over the cracks 
> probabl
> won't work here though.
>
>>  It would be interesting
>> to see version-etc.c after pre-processing.
>
>
> Yes indeed!  Joseph please attach version-etc.pp.gz as generated by the
> following to your next reply:
>
> $ cd src
> $ gcc  -I. -E version-etc.c | gzip -c > version-etc.pp.gz
>
> Cheers,
>     Gary
I am taking 'src' as been /usr/local/appl/gnu/m4/m4-1.4.11/lib , the 
location of my version-etc.c files as there is no   version-etc.c in  my 
/usr/local/appl/gnu/m4/m4-1.4.11/src directory. The gzipped file is 
attached.

Thanks!

--  Joe  --
Attachment (version-etc.pp.gz): application/x-gzip, 7146 bytes
Gary V. Vaughan | 6 May 2008 03:42
Picon
Gravatar

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

Hi Joseph,

On 5 May 2008, at 19:40, Joseph Maxwell wrote:
> Gary V. Vaughan wrote:
>>
>> Yes indeed!  Joseph please attach version-etc.pp.gz as generated by  
>> the
>> following to your next reply:
>>
>> $ cd src
>> $ gcc  -I. -E version-etc.c | gzip -c > version-etc.pp.gz
>
> I am taking 'src' as been /usr/local/appl/gnu/m4/m4-1.4.11/lib , the  
> location of my version-etc.c files as there is no   version-etc.c  
> in  my /usr/local/appl/gnu/m4/m4-1.4.11/src directory. The gzipped  
> file is attached.

Here's what I get around the offending lines with both gcc-3.4.3 and  
gcc-4.2.3 on
mips-sgi-irix6.5:

     while (__builtin_va_arg(tmp_authors,const char *) != 0L)
       ++n_authors;

And with MIPSpro 7.4.4m cc -E on the same machine:

     while (((const char * *)(void *)( tmp_authors = ( va_list)  
(( ( ((__va_iptr_
t)tmp_authors)+((__NO_CFOLD_WARNING( (__builtin_alignof(const char *)  
 > 8) ? (__
va_iptr_t)__builtin_alignof(const char *) : (__va_iptr_t)8 ))-1) ) & (- 
(__NO_CFO
LD_WARNING( (__builtin_alignof(const char *) > 8) ?  
(__va_iptr_t)__builtin_align
of(const char *) : (__va_iptr_t)8 ))) )+ 
(__NO_CFOLD_WARNING( ((__builtin_classof
(const char *) == 0) && (sizeof(const char *) < 8)) ? 8-sizeof(const  
char *) : 0
  ))+sizeof(const char *)) )) [-1] != 0L)
       ++n_authors;

Where in the gcc -E output you sent me, I see:

     while (((const char * *)(void *)( tmp_authors = ( va_list)  
(( ( ((__va_iptr_
t)tmp_authors)+((__NO_CFOLD_WARNING( (__builtin_alignof(const char *)  
 > 8) ? (__
va_iptr_t)__builtin_alignof(const char *) : (__va_iptr_t)8 ))-1) ) & (- 
(__NO_CFO
LD_WARNING( (__builtin_alignof(const char *) > 8) ?  
(__va_iptr_t)__builtin_align
of(const char *) : (__va_iptr_t)8 ))) )+ 
(__NO_CFOLD_WARNING( ((__builtin_classof
(const char *) == 0) && (sizeof(const char *) < 8)) ? 8-sizeof(const  
char *) : 0 ))+sizeof(const char *)) )) [-1] != 0L)
       ++n_authors;

So it looks very much like you're somehow feeding the output of the  
MIPSpro preprocessor to your gcc .  I'd say you need to reinstall gcc  
and try again.

Cheers,
	Gary
--

-- 
   ())_.              Email me: gary <at> gnu.org
   ( '/           Read my blog: http://blog.azazil.net
   / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_

Joseph Maxwell | 5 May 2008 09:46

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

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: gary <at> gnu.org
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ 



Gary V. Vaughan | 6 May 2008 01:28
Picon

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

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: gary <at> gnu.org
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ 




Joseph Maxwell | 6 May 2008 04:46

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

Gary V. Vaughan wrote:
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?

I can't afford an SGI compiler for the price they were asking, I did have access to one years ago.
My OS is IRIX 6.5.22, the limit for the Indigo, I do have an Octane 6.5.26 I think but that should not make much difference I think


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.
I note that you are using gcc4.2.3, I'll upgrade and see, 4.3.0 is the latest stable version. I'll try that.


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: gary <at> gnu.org
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ 




Thanks

Gmane