GNU bug report logs - #68832
Testing: POSIX yacc and C++ linkage

Previous Next

Package: automake;

Reported by: Marcel Telka <marcel <at> telka.sk>

Date: Tue, 30 Jan 2024 23:59:02 UTC

Severity: normal

Full log


Message #8 received at 68832 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: marcel <at> telka.sk
Cc: 68832 <at> debbugs.gnu.org
Subject: Re: bug#68832: Testing: POSIX yacc and C++ linkage
Date: Wed, 31 Jan 2024 15:47:09 -0700
    parse1.yy:30:7: error: conflicting declaration of 'void yyerror(const char*)' with 'C' linkage
    parse1.yy:7:6: note: previous declaration with 'C++' linkage

Thanks much for the careful and complete report.

I think this is another manifestation of what Bogdan fixed in other
cases in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62886. His idea
there was to essentially add an extern "C" only on Solaris, via
sufficient #ifdef's.

In these new cases, I guess braces would be required, so the test code
would end up looking like:

#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
extern "C" {
#endif
int yylex (void) { return std::getchar (); }
void yyerror (const char *s) {}
#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
}
#endif

Although I could try to do this, I can't easily test the result, and I'd
probably mess up the editing. I'm also far from sure that this will
actually solve the problem without introducing new ones.

So maybe you could edit one of the test *.sh files and rerun the test
and see what happens? In case you don't know, you can run a single test
with, e.g.,
  make check TESTS='t/yacc-cxx.sh' keep_testdirs=yes
(the keep_testdirs keeps the <testdir>.dir/ around so it can be
inspected afterward.)

    My proposal to solve the issue is to change affected tests to
    require bison instead of yacc.  

A lot of work has gone into making the tests work with Solaris tools
(despite the current failures), so I'm reluctant to throw that
possibility away.

Also, there have been similar bug reports with older versions of bison.
There is no panacea :( ...  --thanks, karl.




This bug report was last modified 1 year and 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.