From 7ebc7e677d3d2a70c832a672e9f2e6b12896354f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 22 Dec 2008 03:21:10 +0100 Subject: pidl: Allow location argument to warning() and error() to be undef, in case it is not known. --- pidl/lib/Parse/Pidl.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pidl/lib/Parse/Pidl.pm') diff --git a/pidl/lib/Parse/Pidl.pm b/pidl/lib/Parse/Pidl.pm index c2c9463d03..40e3673908 100644 --- a/pidl/lib/Parse/Pidl.pm +++ b/pidl/lib/Parse/Pidl.pm @@ -20,13 +20,19 @@ $VERSION = '0.02'; sub warning { my ($l,$m) = @_; - print STDERR "$l->{FILE}:$l->{LINE}: warning: $m\n"; + if ($l) { + print STDERR "$l->{FILE}:$l->{LINE}: "; + } + print STDERR "warning: $m\n"; } sub error { my ($l,$m) = @_; - print STDERR "$l->{FILE}:$l->{LINE}: error: $m\n"; + if ($l) { + print STDERR "$l->{FILE}:$l->{LINE}: "; + } + print STDERR "error: $m\n"; } sub fatal($$) -- cgit