pidl: Allow location argument to warning() and error() to be undef, in case it is
authorJelmer Vernooij <jelmer@samba.org>
Mon, 22 Dec 2008 02:21:10 +0000 (03:21 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 22 Dec 2008 02:21:10 +0000 (03:21 +0100)
not known.

pidl/lib/Parse/Pidl.pm

index c2c9463d03f9445b65dc27913b53ff18d954c897..40e3673908e0c54d680ec3667a6cec5083b0c93e 100644 (file)
@@ -20,13 +20,19 @@ $VERSION = '0.02';
 sub warning
 {
        my ($l,$m) = @_;
 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) = @_;
 }
 
 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($$) 
 }
 
 sub fatal($$)