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:53:30 +0200 Message-ID: <51DBB36A.6040305@lysator.liu.se> References: <51DB4207.6080204@lysator.liu.se> <83d2qswj3w.fsf@gnu.org> <51DBAD55.3050702@lysator.liu.se> 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 1373352849 24970 80.91.229.3 (9 Jul 2013 06:54:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Jul 2013 06:54:09 +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:54:10 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 1UwRoO-0000up-SJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Jul 2013 08:54:09 +0200 Original-Received: from localhost ([::1]:45045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRoO-0006q7-BI for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Jul 2013 02:54:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRoK-0006pz-D5 for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:54:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwRoJ-0002lV-8W for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:54:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwRoJ-0002lQ-5c for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:54:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UwRoI-0001Lj-EZ for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2013 02:54: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:54:02 +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.13733528185139 (code B ref 14830); Tue, 09 Jul 2013 06:54:02 +0000 Original-Received: (at 14830) by debbugs.gnu.org; 9 Jul 2013 06:53:38 +0000 Original-Received: from localhost ([127.0.0.1]:41065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UwRns-0001Kn-RV for submit@debbugs.gnu.org; Tue, 09 Jul 2013 02:53:37 -0400 Original-Received: from mail.lysator.liu.se ([130.236.254.3]:54006) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UwRno-0001Kb-IY for 14830@debbugs.gnu.org; Tue, 09 Jul 2013 02:53:34 -0400 Original-Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 9B44F40012; Tue, 9 Jul 2013 08:53:31 +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 320BE40011; Tue, 9 Jul 2013 08:53:31 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <51DBAD55.3050702@lysator.liu.se> 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:76115 Archived-At: On 2013-07-09 08:27, Peter Rosin wrote: > 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. Hmm, the below variant is perhaps clearer? It expands into: #include #include int main () { PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader); return 0; } Cheers, Peter diff --git a/ChangeLog b/ChangeLog index 220cffb..3ba3093 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 already 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..ddfef68 100644 --- a/configure.ac +++ b/configure.ac @@ -1635,8 +1635,7 @@ if test "${opsys}" = "mingw32"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include ]], - [[void test(PIMAGE_NT_HEADERS pHeader) - {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]])], + [[PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])], [emacs_cv_w32api=yes HAVE_W32=yes], emacs_cv_w32api=no) -- 1.7.9