Author: jelmer
Date: 2006-05-14 00:22:24 +0000 (Sun, 14 May 2006)
New Revision: 15593

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15593

Log:
Warn about [out] arguments that are not pointers. These can all be 
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)

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/ODL.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm        2006-05-14 
00:07:03 UTC (rev 15592)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm        2006-05-14 
00:22:24 UTC (rev 15593)
@@ -540,6 +540,11 @@
                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);
        }
 

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/ODL.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/ODL.pm        2006-05-14 
00:07:03 UTC (rev 15592)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/ODL.pm        2006-05-14 
00:22:24 UTC (rev 15593)
@@ -15,11 +15,10 @@
 # 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 @@
                '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}
        });
 }
 

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm      
2006-05-14 00:07:03 UTC (rev 15592)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm      
2006-05-14 00:22:24 UTC (rev 15593)
@@ -85,11 +85,6 @@
        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}");
        }
 

Reply via email to