r15593: Warn about [out] arguments that are not pointers. These can all be
authorJelmer Vernooij <jelmer@samba.org>
Sun, 14 May 2006 00:22:24 +0000 (00:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:06:02 +0000 (14:06 -0500)
fixed by adding [ref] pointers.

This will cause a lot of warnings to be outputted by pidl for now. I will
fix these gradually over the next few days.

We need to avoid [out] arguments that are not pointers because they are
not understood by other IDL compilers and don't work with some of
our output modules (Samba3, Samba3NDR and ethereal)
(This used to be commit c4ab021ee8d93aa74f15deebf64a366b33b7bb9f)

source4/pidl/lib/Parse/Pidl/NDR.pm
source4/pidl/lib/Parse/Pidl/ODL.pm
source4/pidl/lib/Parse/Pidl/Samba3/Client.pm

index a4008a1545619c1f8c597554128a2540d317c9f5..3cbf416488f8ae9767731c7c29be8881c20aea74 100644 (file)
@@ -540,6 +540,11 @@ sub ParseFunction($$$)
                my $e = ParseElement($x);
                push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
                push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
+
+               nonfatal($x, "`$e->{NAME}' is [out] argument but not a pointer")
+                       if ($e->{LEVELS}[0]->{TYPE} ne "POINTER") and 
+                           grep(/out/, @{$e->{DIRECTION}});
+
                push (@elements, $e);
        }
 
index 082deaea1d7e7b09e36003c6fc322b3b9fc351ae..b5d65b6239a1852789989296476941791c22c65e 100644 (file)
@@ -15,11 +15,10 @@ $VERSION = '0.01';
 # find an interface in an array of interfaces
 sub get_interface($$)
 {
-       my($if) = shift;
-       my($n) = shift;
+       my($if,$n) = @_;
 
-       foreach(@{$if}) {
-               if($_->{NAME} eq $n) { return $_; }
+       foreach(@$if) {
+               return $_ if($_->{NAME} eq $n);
        }
        
        return 0;
@@ -33,13 +32,17 @@ sub FunctionAddObjArgs($)
                'NAME' => 'ORPCthis',
                'POINTERS' => 0,
                'PROPERTIES' => { 'in' => '1' },
-               'TYPE' => 'ORPCTHIS'
+               'TYPE' => 'ORPCTHIS',
+               'FILE' => $e->{FILE},
+               'LINE' => $e->{LINE}
        });
        unshift(@{$e->{ELEMENTS}}, {
                'NAME' => 'ORPCthat',
                'POINTERS' => 0,
                'PROPERTIES' => { 'out' => '1' },
-               'TYPE' => 'ORPCTHAT'
+               'TYPE' => 'ORPCTHAT',
+               'FILE' => $e->{FILE},
+               'LINE' => $e->{LINE}
        });
 }
 
index 59f0341d022c94ab71f650fd7533710ffafa6f89..9e26e9a21e6b0137ef48f8507d3eb2964f360d96 100644 (file)
@@ -85,11 +85,6 @@ sub ParseFunction($$)
        foreach my $e (@{$fn->{ELEMENTS}}) {
                next unless (grep(/out/, @{$e->{DIRECTION}}));
 
-               if ($e->{LEVELS}[0]->{TYPE} ne "POINTER") {
-                       warning($e->{ORIGINAL}, "First element not a pointer for [out] argument");
-                       next;
-               }
-
                CopyLevel($e, $e->{LEVELS}[1], $e->{NAME}, "r.$e->{NAME}");
        }