From 631aa1f0efa75924c4d8ba639de80527fb8da7b5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 5 Mar 2005 18:34:18 +0000 Subject: r5661: Be a little stricter on syntax regarding arrays. A pointer to an array can now only be : type *name[]; rather then : type *name; which was supported in the past. Warnings will be given when the first syntax is used. Reasons for this change in behaviour include improved readability and the fact that the second format makes dealing with multiple levels of pointers harder. (This used to be commit a416de5825c540fd3741731c4be05e9a659a6fdb) --- source4/build/pidl/ndr.pm | 3 +++ source4/build/pidl/util.pm | 2 +- source4/build/pidl/validator.pm | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'source4/build') diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm index 8a654f7165..6af3aa852d 100644 --- a/source4/build/pidl/ndr.pm +++ b/source4/build/pidl/ndr.pm @@ -291,6 +291,8 @@ sub ParseExpr($$$) my $e2 = util::find_sibling($e, $size); + die("Invalid sibling '$size'") unless defined($e2); + if (util::has_property($e2, "in") && util::has_property($e2, "out")) { return $prefix . "$var_prefix$size"; } @@ -460,6 +462,7 @@ sub ParseArrayPrint($$) my $e = shift; my $var_prefix = shift; my $size = ParseExpr($e, util::array_size($e), $var_prefix); + my $ptr_prefix = c_ptr_prefix($e); if (is_varying_array($e)) { $size = ParseExpr($e, util::has_property($e, "length_is"), $var_prefix); diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm index f216f75572..5adbea3859 100644 --- a/source4/build/pidl/util.pm +++ b/source4/build/pidl/util.pm @@ -262,7 +262,7 @@ sub find_sibling($$) return $e2 if ($e2->{NAME} eq $name); } - die "invalid sibling '$name'"; + return undef; } 1; diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm index 37f2e26e41..1636a155e3 100644 --- a/source4/build/pidl/validator.pm +++ b/source4/build/pidl/validator.pm @@ -44,6 +44,15 @@ sub ValidElement($) if (util::has_property($e, "ptr")) { fatal(el_name($e) . " : pidl does not support full NDR pointers yet\n"); } + + if (util::has_property($e, "size_is") and not defined ($e->{ARRAY_LEN})) { + fatal(el_name($e) . " : size_is() on non-array element"); + } + + if (util::has_property($e, "length_is") and not defined ($e->{ARRAY_LEN})) { + fatal(el_name($e) . " : length_is() on non-array element"); + } + if (!$e->{POINTERS} && ( util::has_property($e, "ptr") or -- cgit