From 55d6205cf815afc1f51cc12d34cf4116989d76fd Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Fri, 24 Jun 2011 18:32:35 +0200 Subject: [PATCH] Add explicit initialization for return values Plain types were automatically initialized to NULL up to and including ANTLR 3.2, but this changed (for the better) in later versions. --- src/DAAP2SQL.g | 1 + src/RSP2SQL.g | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/DAAP2SQL.g b/src/DAAP2SQL.g index b10c772b..d1cf0dda 100644 --- a/src/DAAP2SQL.g +++ b/src/DAAP2SQL.g @@ -48,6 +48,7 @@ options { } query returns [ pANTLR3_STRING result ] +@init { $result = NULL; } : e = expr { if (!$e.valid) diff --git a/src/RSP2SQL.g b/src/RSP2SQL.g index c2c6b242..8796dba3 100644 --- a/src/RSP2SQL.g +++ b/src/RSP2SQL.g @@ -54,6 +54,7 @@ options { } query returns [ pANTLR3_STRING result ] +@init { $result = NULL; } : e = expr { if (!$e.valid) @@ -225,6 +226,7 @@ strcrit returns [ pANTLR3_STRING result, int valid ] ; strop returns [ pANTLR3_COMMON_TOKEN op ] +@init { $op = NULL; } : n = EQUAL { $op = $n->getToken($n); } | n = INCLUDES @@ -297,6 +299,7 @@ intcrit returns [ pANTLR3_STRING result, int valid ] ; intop returns [ pANTLR3_COMMON_TOKEN op ] +@init { $op = NULL; } : n = EQUAL { $op = $n->getToken($n); } | n = LESS @@ -369,6 +372,7 @@ datecrit returns [ pANTLR3_STRING result, int valid ] ; dateop returns [ pANTLR3_COMMON_TOKEN op ] +@init { $op = NULL; } : n = BEFORE { $op = $n->getToken($n); } | n = AFTER