On Thu, 13 Sep 2007, Paul Cochrane wrote:

> The weird thing is that there *is* a graceful 'no compiler' message.
> If cc_build fails then inter::progs exits with an appropriate error
> message, and configuration stops at this point.

That depends on the nature of the failure in cc_build.  In the example in 
the ticket, I was running cc_build with perl-5.6.2, but cc_build used a 
form of 3-arg open available only in 5.8.x.  Checking $@ would have
turned up that error.

Stepping back a moment, the following construct is just odd:

    unless ( eval { cc_run(); 1 } )

What's the purpose of the '1' there?  cc_run() should be given a 
meaningful return value, and then that return value should be checked.

Also, any time you run an eval, it makes sense to check whether the eval 
generated any errors.  The cc_run() call checks $@, but the cc_build call 
does not.

Here's something like what I have in mind.  Don't apply this now -- it 
won't work because it incorrectly relies on the return values of cc_build 
and cc_run.  Those values aren't even currently documented.  There's a 
decision to be made there -- shall they return '0 means OK' (reflecting 
that (on Unix, at least) they are implemented in terms of system()) or 
shall they return 'non-zero means OK'?  The latter would allow them to be 
used "naturally" with tests like:  if (cc_run()) { print "Ok\n";}.

diff -r -u parrot-current/config/inter/progs.pm 
parrot-andy/config/inter/progs.pm
--- parrot-current/config/inter/progs.pm        2007-09-12 11:15:13.000000000 
-0400
+++ parrot-andy/config/inter/progs.pm   2007-09-13 13:47:13.000000000 -0400
@@ -141,13 +141,19 @@
 END_C
     close $out_fh;
 
-    unless ( eval { cc_build(); 1 } ) {
+    unless ( eval { cc_build() } ) {
+        warn $@ if $@;
+        # XXX Should be more verbose here -- write out the actual
+        # test program and command line that failed so that the user
+        # can easily reproduce and fix the problem.
         warn "Compilation failed with '$cc'\n";
         exit 1;
     }
 
-    unless ( eval { cc_run(); 1 } ) {
+    unless ( eval { cc_run() } ) {
         warn $@ if $@;
+        # XXX Should be more verbose here -- See above.
+        warn "Running the test program failed with '$cc'\n";
         exit 1;
     }
 }

> The only place this doesn't work is on
> Solaris (for some reason C<exit 1;> just doesn't seem to want to exit
> on this platform). 

I'm afraid I don't know what you mean here.  exit seems to work just fine.
I think you must be referring to some different problem.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to