Commit 364e1c87 authored by Sergio Costas's avatar Sergio Costas

Return to messages without the file name

parent cb93bc13
......@@ -1676,7 +1676,7 @@ class crust(object):
if (thread["node"] is not None):
var_data = self._find_variable(tmp_status, thread["node"].name, node.line)
if var_data["value"] == self.VALUE_UNINITIALIZED:
self._add_error(tmp_status, self.MSG_ERROR, "Returning variable '{:s}' at line {:d}, file '{:s}', is uninitialized",thread["node"].name, node.line, node.filename)
self._add_error(tmp_status, self.MSG_ERROR, "Returning variable '{:s}' at line {:d} is uninitialized",thread["node"].name, node.line)
if (var_data["value"] == self.VALUE_FREED) or (var_data["value"] == self.VALUE_FREED_OR_NULL):
self._add_error(tmp_status, self.MSG_ERROR, "Returning variable '{:s}' at line {:d} was freed at line {:d}",thread["node"].name, node.line, var_data["init_line"])
if (self._check_statement_is_crust(thread["node"], var_data)) and (thread["type"] == self.TYPE_CRUST) and (not var_data["borrowed"]):
......@@ -1688,11 +1688,11 @@ class crust(object):
if tmp_status["returned_something"] == True:
if (thread["type"] == self.TYPE_CRUST) and (tmp_status["return_is_crust"] == False):
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a crust value, but is must return a non-crust one", node.line, node.filename)
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d} is returning a crust value, but is must return a non-crust one", node.line)
if (thread["type"] != self.TYPE_CRUST) and (tmp_status["return_is_crust"] == True) and (thread["value"] != self.VALUE_NULL):
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a non-crust value, but is must return a crust one", node.line, node.filename)
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d} is returning a non-crust value, but is must return a crust one", node.line)
if tmp_status["return_is_crust"] is None:
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a value, but the function '{:s}' does not return a value", node.line, node.filename, tmp_status["current_function"])
self._add_error(tmp_status, self.MSG_ERROR, "Return statement at line {:d} is returning a value, but the function '{:s}' does not return a value", node.line, tmp_status["current_function"])
if thread["node"] is None:
return_is_borrowed = False
else:
......
......@@ -662,10 +662,10 @@ class Test(unittest.TestCase):
self._all_fine_test("unitest/test135.c")
def test136ReturnCrustExpectNoCrust(self):
self._generic_test("unitest/test136.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a crust value, but is must return a non-crust one", 7, 'unitest/test136.c') ])
self._generic_test("unitest/test136.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d} is returning a crust value, but is must return a non-crust one", 7) ])
def test137ReturnNoCrustExpectCrust(self):
self._generic_test("unitest/test137.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a non-crust value, but is must return a crust one", 7, 'unitest/test137.c') ])
self._generic_test("unitest/test137.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d} is returning a non-crust value, but is must return a crust one", 7) ])
def test138OddBreakInFor(self):
self._generic_test("unitest/test138.c", [ (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point in line {:d}", "param1", 7, 15) ])
......@@ -752,7 +752,7 @@ class Test(unittest.TestCase):
self._generic_test("unitest/test165.c", [ (crust.crust.MSG_ERROR, "Function '{:s}' expects a return value, but the code exited without it", "main") ])
def test166ExpectedNoReturnValueButValueAvailable(self):
self._generic_test("unitest/test166.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d}, file '{:s}', is returning a value, but the function '{:s}' does not return a value", 7, 'unitest/test166.c', "main") ])
self._generic_test("unitest/test166.c", [ (crust.crust.MSG_ERROR, "Return statement at line {:d} is returning a value, but the function '{:s}' does not return a value", 7, "main") ])
def test167ExpectedReturnValueEmptyReturn(self):
self._generic_test("unitest/test167.c", [ (crust.crust.MSG_ERROR, "Function '{:s}' expects a return value, but the code exited at line {:d} without it", "main", 9) ])
......@@ -764,7 +764,7 @@ class Test(unittest.TestCase):
self._generic_test("unitest/test169.c", [ (crust.crust.MSG_ERROR, "Returning variable '{:s}' at line {:d} was freed at line {:d}", "param", 7, 6) ])
def test170ReturnedUninitializedValue(self):
self._generic_test("unitest/test170.c", [ (crust.crust.MSG_ERROR, "Returning variable '{:s}' at line {:d}, file '{:s}', is uninitialized", "param", 5, 'unitest/test170.c') ])
self._generic_test("unitest/test170.c", [ (crust.crust.MSG_ERROR, "Returning variable '{:s}' at line {:d} is uninitialized", "param", 5) ])
def test171IgnoreBorrowReturnValue(self):
self._all_fine_test("unitest/test171.c")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment