From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Rosin Newsgroups: gmane.emacs.bugs Subject: bug#14830: [PATCH] * configure.ac (HAVE_W32): Avoid nested functions Date: Tue, 09 Jul 2013 08:27:33 +0200 Message-ID: <51DBAD55.3050702@lysator.liu.se> References: <51DB4207.6080204@lysator.liu.se> <83d2qswj3w.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1373351288 10051 80.91.229.3 (9 Jul 2013 06:28:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Jul 2013 06:28:08 +0000 (UTC) Cc: 14830@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 09 08:28:08 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UwRPE-0003TY-4Z for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Jul 2013 08:28:08 +0200 Original-Received: from localhost ([::1]:40228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRPD-0004Bi-Lp for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Jul 2013 02:28:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRPA-0004B3-5d for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwRP9-0003NG-46 for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:28:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRP9-0003N7-14 for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:28:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UwRP7-0000E7-U5 for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Peter Rosin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Jul 2013 06:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14830 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 14830-submit@debbugs.gnu.org id=B14830.1373351265819 (code B ref 14830); Tue, 09 Jul 2013 06:28:01 +0000 Original-Received: (at 14830) by debbugs.gnu.org; 9 Jul 2013 06:27:45 +0000 Original-Received: from localhost ([127.0.0.1]:41023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UwROp-0000D3-Jr for submit@debbugs.gnu.org; Tue, 09 Jul 2013 02:27:45 -0400 Original-Received: from mail.lysator.liu.se ([130.236.254.3]:41729) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UwROj-0000Cb-9U for 14830@debbugs.gnu.org; Tue, 09 Jul 2013 02:27:39 -0400 Original-Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 4A33040011; Tue, 9 Jul 2013 08:27:35 +0200 (CEST) Original-Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com [90.227.119.137]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 0AD014000B; Tue, 9 Jul 2013 08:27:34 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <83d2qswj3w.fsf@gnu.org> X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76111 Archived-At: On 2013-07-09 04:41, Eli Zaretskii wrote: >> Date: Tue, 09 Jul 2013 00:49:43 +0200 >> From: Peter Rosin >> >> diff --git a/ChangeLog b/ChangeLog >> index 220cffb..03011cf 100644 >> --- a/ChangeLog >> +++ b/ChangeLog >> @@ -1,3 +1,8 @@ >> +2013-07-09 Peter Rosin (tiny change> >> + >> + * configure.ac (HAVE_W32): Avoid nested functions (the second >> + argument of AC_LANG_PROGRAM is expanded inside a function). >> + >> 2013-07-08 Magnus Henoch (tiny change) >> >> * configure.ac (HAVE_IMAGEMAGICK): Check on NS also (Bug#14798). >> diff --git a/configure.ac b/configure.ac >> index 3830ee3..1188f1b 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -1632,10 +1632,10 @@ fi >> >> if test "${opsys}" = "mingw32"; then >> AC_MSG_CHECKING([whether Windows API headers are recent enough]) >> - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ >> + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ >> #include >> - #include ]], >> - [[void test(PIMAGE_NT_HEADERS pHeader) >> + #include >> + void test(PIMAGE_NT_HEADERS pHeader) >> {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]])], >> [emacs_cv_w32api=yes >> HAVE_W32=yes], > > Sorry, I don't follow: what is the problem with the current code? > AC_LANG_PROGRAM([[ #include #include ]], [[void test(PIMAGE_NT_HEADERS pHeader) {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]]) is expanded into the following program (enhanced whitespace): #include #include int main () { void test(PIMAGE_NT_HEADERS pHeader) { PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader); } ; return 0; } My fixed version with AC_LANG_SOURCE will not emit the main() function and thus avoids nested functions and instead generates this source (again with enhanced whitespace): #include #include void test(PIMAGE_NT_HEADERS pHeader) { PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader); } The background is that when trying to configure with an unsupported compiler, MSVC in this case, it errors out with "the Windows API headers are too old to support this build", which is a bogus error message. Agreed, it doesn't really change anything for supported configurations, but being able to nest functions has nothing to do with the test at hand. Cheers, Peter