summaryrefslogtreecommitdiff
path: root/source4/build/pidl/Parse/Pidl/Compat.pm
blob: f81d73f36afd58b9cad700761bd011c6f01dd6bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
###################################################
# IDL Compatibility checker
# Copyright jelmer@samba.org 2005
# released under the GNU GPL

package Parse::Pidl::Compat;

use strict;

my($res);

sub warning($$)
{
	my $l = shift;
	my $m = shift;

	print "$l->{FILE}:$l->{LINE}:$m\n";
}

sub CheckInterface($)
{
	my $if = shift;
	if (util::has_property($if, "pointer_default_top")) {
		warning($if, "pointer_default_top() is pidl-specific");
	}

	foreach my $x (@{$if->{DATA}}) {
		if ($x->{TYPE} eq "DECLARE") {
			warning($if, "the declare keyword is pidl-specific");
			next;
		}

		if ($x->{TYPE} eq "TYPEDEF") {
			if ($x->{DATA}->{TYPE} eq "UNION") {
				if (util::has_property($x, "nodiscriminant")) {
					warning($x, "nodiscriminant property is pidl-specific");
				}
			}
		}
	}
}

sub Check($)
{
	my $pidl = shift;
	my $res = "";

	foreach my $x (@{$pidl}) {
		CheckInterface($x) if ($x->{TYPE} eq "INTERFACE");
	}

	return $res;
}

1;