develooper Front page | perl.perl5.porters | Postings from September 2011

[perl #99368] h2ph-generated code to avoid macro redefinitions doesn't work

Thread Previous
From:
l . mai @ web . de
Date:
September 17, 2011 10:01
Subject:
[perl #99368] h2ph-generated code to avoid macro redefinitions doesn't work
Message ID:
rt-3.6.HEAD-31297-1316278856-301.99368-75-0@perl.org
# New Ticket Created by  l.mai@web.de 
# Please include the string:  [perl #99368]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=99368 >


Hi,

h2ph generates code of the form

 unless(defined(&FOO)) {
     sub FOO () {42;}
 }

for a C macro like '#define FOO 42'.

The problem with that: 'sub' happens at compile time, 'unless' at runtime.
So the sub is unconditionally defined first, then the unless runs with
an empty body.

I've attached a git patch that should solve the problem.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About