ctdb-tests: Fix some incorrect memory allocations
[obnox/samba/samba-obnox.git] / pidl / idl.yp
index b3d5ed16ac0657c1d5994531aeed720629528400..c8a65f6f629328e752c26eecfe5a6cd42d05b446 100644 (file)
@@ -387,7 +387,31 @@ pipe:
        {{
                "TYPE" => "PIPE",
                "PROPERTIES" => $_[1],
-               "DATA" => $_[3],
+               "NAME" => undef,
+               "DATA" => {
+                       "TYPE" => "STRUCT",
+                       "PROPERTIES" => $_[1],
+                       "NAME" => undef,
+                       "ELEMENTS" => [{
+                               "NAME" => "count",
+                               "PROPERTIES" => $_[1],
+                               "POINTERS" => 0,
+                               "ARRAY_LEN" => [],
+                               "TYPE" => "uint3264",
+                               "FILE" => $_[0]->YYData->{FILE},
+                               "LINE" => $_[0]->YYData->{LINE},
+                       },{
+                               "NAME" => "array",
+                               "PROPERTIES" => $_[1],
+                               "POINTERS" => 0,
+                               "ARRAY_LEN" => [ "count" ],
+                               "TYPE" => $_[3],
+                               "FILE" => $_[0]->YYData->{FILE},
+                               "LINE" => $_[0]->YYData->{LINE},
+                       }],
+                       "FILE" => $_[0]->YYData->{FILE},
+                       "LINE" => $_[0]->YYData->{LINE},
+               },
                "FILE" => $_[0]->YYData->{FILE},
                "LINE" => $_[0]->YYData->{LINE},
        }}
@@ -586,7 +610,9 @@ again:
 
        for ($parser->YYData->{INPUT}) {
                if (/^\#/) {
-                       if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
+                       # Linemarker format is described at
+                       # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
+                       if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
                                $parser->YYData->{LINE} = $1-1;
                                $parser->YYData->{FILE} = $2;
                                goto again;
@@ -653,11 +679,17 @@ sub parse_file($$)
        my $saved_delim = $/;
        undef $/;
        my $cpp = $ENV{CPP};
+       my $options = "";
        if (! defined $cpp) {
-               $cpp = "cpp";
+               if (defined $ENV{CC}) {
+                       $cpp = "$ENV{CC}";
+                       $options = "-E";
+               } else {
+                       $cpp = "cpp";
+               }
        }
        my $includes = join('',map { " -I$_" } @$incdirs);
-       my $data = `$cpp -D__PIDL__$includes -xc $filename`;
+       my $data = `$cpp $options -D__PIDL__$includes -xc "$filename"`;
        $/ = $saved_delim;
 
        return parse_string($data, $filename);