Thanks, Craig.

Rather than keeping an %args hash and a $config_defines string separately, it would seem simpler to

On Mar 15, 2006, at 6:57 AM, Craig A. Berry wrote:

At 10:59 PM -0500 3/14/06, John E. Malmberg wrote:

is an update Craig's patch to handle the cases where there are no defines at all, or only defines from config.

In practice, I'm not sure that will ever happen as all XS compiles
get the version number as a define.

You're probably right, but it's easy enough to squash the bug anyway:

--- lib/ExtUtils/CBuilder/Platform/VMS.pm 15 Mar 2006 22:48:16 -0000 1.11
+++ lib/ExtUtils/CBuilder/Platform/VMS.pm       15 Mar 2006 22:50:29 -0000
@@ -14,17 +14,17 @@
   s/"/""/g foreach values %args;
-  my $config_defines = '';
+  my $config_defines;
# VMS can only have one define qualifier; add the one from config, if any. if ($self->{config}{ccflags} =~ s{/def[^=]+(?:=)+(?:\()?([^\/\)] *)} {}i) {
-    $config_defines = "$1,";
+    $config_defines = $1;
   }
   return unless (scalar keys %args) || $config_defines;
   return ('/define=('
-          . $config_defines
+          . (defined $config_defines ? "$config_defines," : '')
           . join(',',
map "\"$_" . ( length($args{$_}) ? "=$args{$_}" : '') . "\"",
                      keys %args)


The other scenario it now handles that it didn't before is when there
is a define with a key but no value.  This is still currently broken
in the generic version of arg_defines (and no current test exercises
it).  So if you pass the following to compile:

defines => { FOO => Bar, Baz }

You get this:

-DBaz= -DFOO=Bar

where the equals sign after Baz seems likely to cause trouble (though
I don't know offhand what compilers will do with that).

I believe that's just fine for compilers, it simply means that Baz should be defined as the empty string, right?

I just verified that -Dfoo , -Dfoo= , and -Dfoo=bar all seem to make the C preprocessor happy, producing results of 1, the empty string, and 'bar', respectively.

 -Ken

Reply via email to