Received: (at 68832) by debbugs.gnu.org; 31 Jan 2024 22:47:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 31 17:47:22 2024 Received: from localhost ([127.0.0.1]:39221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rVJMY-0006rs-9z for submit <at> debbugs.gnu.org; Wed, 31 Jan 2024 17:47:22 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:54590 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <karl@HIDDEN>) id 1rVJMV-0006qu-Kg for 68832 <at> debbugs.gnu.org; Wed, 31 Jan 2024 17:47:20 -0500 X-Envelope-From: karl@HIDDEN Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 40VMl9LT001289 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 15:47:09 -0700 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 40VMl92F001288; Wed, 31 Jan 2024 15:47:09 -0700 Date: Wed, 31 Jan 2024 15:47:09 -0700 Message-Id: <202401312247.40VMl92F001288@HIDDEN> From: Karl Berry <karl@HIDDEN> To: marcel@HIDDEN Subject: Re: bug#68832: Testing: POSIX yacc and C++ linkage In-Reply-To: <ZbldnY-_UKmOctnv@telcontar> X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68832 Cc: 68832 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) 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.
bug-automake@HIDDEN
:bug#68832
; Package automake
.
Full text available.Received: (at submit) by debbugs.gnu.org; 30 Jan 2024 23:58:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 30 18:58:20 2024 Received: from localhost ([127.0.0.1]:37135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rUxzd-0001gT-4S for submit <at> debbugs.gnu.org; Tue, 30 Jan 2024 18:58:20 -0500 Received: from lists.gnu.org ([2001:470:142::17]:50492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <marcel@HIDDEN>) id 1rUuq3-0004uJ-TZ for submit <at> debbugs.gnu.org; Tue, 30 Jan 2024 15:36:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <marcel@HIDDEN>) id 1rUupo-00011w-Sn for bug-automake@HIDDEN; Tue, 30 Jan 2024 15:35:57 -0500 Received: from tortuga.telka.sk ([185.14.234.118]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <marcel@HIDDEN>) id 1rUupm-0000xX-Ge for bug-automake@HIDDEN; Tue, 30 Jan 2024 15:35:56 -0500 Received: (qmail 15413 invoked from network); 30 Jan 2024 20:35:42 -0000 Received: from telcontar.in.telka.sk (HELO telcontar) (marcel@HIDDEN) by tortuga.telka.sk with ESMTPSA (DHE-RSA-AES256-GCM-SHA384 encrypted); 30 Jan 2024 20:35:42 -0000 Date: Tue, 30 Jan 2024 21:35:41 +0100 From: Marcel Telka <marcel@HIDDEN> To: bug-automake@HIDDEN Subject: Testing: POSIX yacc and C++ linkage Message-ID: <ZbldnY-_UKmOctnv@telcontar> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Yf0zFUp9B7SJlIQ6" Content-Disposition: inline Received-SPF: pass client-ip=185.14.234.118; envelope-from=marcel@HIDDEN; helo=tortuga.telka.sk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 30 Jan 2024 18:58:16 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) --Yf0zFUp9B7SJlIQ6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I ran tests for automake 1.16.5 on OpenIndiana and following 4 tests failed: FAIL: t/yacc-cxx.sh FAIL: t/yacc-clean-cxx.sh FAIL: t/yacc-d-cxx.sh FAIL: t/yacc-mix-c-cxx.sh The cause for the failure is this: 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 7 | void yyerror (const char *s) {} | ^~~~~~~ parse1.yy:34:6: error: conflicting declaration of 'int yylex()' with 'C' linkage parse1.yy:6:5: note: previous declaration with 'C++' linkage 6 | int yylex (void) { return std::getchar (); } | ^~~~~ For testing there is the default system yacc used. It is the illumos yacc as inherited from Solaris with some changes[1]. The generated code that causes the failure is this: 24 #if defined(__cplusplus) || defined(__STDC__) 25 26 #if defined(__cplusplus) 27 extern "C" { 28 #endif 29 #ifndef yyerror 30 #if defined(__cplusplus) 31 void yyerror(YYCONST char *); 32 #endif 33 #endif 34 #ifndef yylex 35 int yylex(void); 36 #endif 37 int yyparse(void); 38 #if defined(__cplusplus) 39 } 40 #endif 41 42 #endif The issue is apparent. The yacc generated code create both yyerror() and yylex() with the C linkage, but testing expects C++ linkage. This is exactly what the compiler error says. All of this is obvious. So where is the bug and what should be fixed? There are few possible views: 1. yacc is buggy and should not force C linkage for C++ source. This is grey area because POSIX says nothing about linkage or C++[2]. 2. The tests' expectations about yacc behavior re C++ are too strong. This seems to be true for illumos yacc. Other yacc implementations, for example GNU bison, does better job and do not force C linkage for affected functions. My proposal to solve the issue is to change affected tests to require bison instead of yacc. Please see attachment. Thank you. [1] for example this: https://www.illumos.org/issues/16136 [2] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html -- +-------------------------------------------+ | Marcel Telka e-mail: marcel@HIDDEN | | homepage: http://telka.sk/ | +-------------------------------------------+ --Yf0zFUp9B7SJlIQ6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="automake-1.16.5-test-yacc-cxx-bison.patch" --- automake-1.16.5/t/yacc-cxx.sh.orig +++ automake-1.16.5/t/yacc-cxx.sh @@ -18,7 +18,7 @@ # headers are not involved). # Keep in sync with sister test 'yacc-basic.sh'. -required='c++ yacc' +required='c++ bison' . test-init.sh cat >> configure.ac << 'END' --- automake-1.16.5/t/yacc-clean-cxx.sh.orig +++ automake-1.16.5/t/yacc-clean-cxx.sh @@ -20,7 +20,7 @@ # "make maintainer-clean". # See also sister test 'yacc-clean.sh'. -required='c++ yacc' +required='c++ bison' . test-init.sh cat >> configure.ac << 'END' --- automake-1.16.5/t/yacc-d-cxx.sh.orig +++ automake-1.16.5/t/yacc-d-cxx.sh @@ -18,7 +18,7 @@ # (i.e., '-d' in *YFLAGS). # Keep in sync with sister test 'yacc-d-basic.sh'. -required='c++ yacc' +required='c++ bison' . test-init.sh write_parse () --- automake-1.16.5/t/yacc-mix-c-cxx.sh.orig +++ automake-1.16.5/t/yacc-mix-c-cxx.sh @@ -17,7 +17,7 @@ # Check that many different Yacc parsers (both C and C++) can co-exists # in the same directory. -required='cc c++ yacc' +required='cc c++ bison' . test-init.sh cat >> configure.ac << 'END' --Yf0zFUp9B7SJlIQ6--
Marcel Telka <marcel@HIDDEN>
:bug-automake@HIDDEN
.
Full text available.bug-automake@HIDDEN
:bug#68832
; Package automake
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.