Commit 32077f8b authored by Sergio Costas's avatar Sergio Costas

Now doesn't fail when assigning to an element in a struct pointer

Now recognizes __builtin_swap16 and __builtin_clz

Now detects correctly when a function returns a pointer to void
parent 9ad1a498
This diff is collapsed.
...@@ -662,10 +662,10 @@ class Test(unittest.TestCase): ...@@ -662,10 +662,10 @@ class Test(unittest.TestCase):
self._all_fine_test("unitest/test135.c") self._all_fine_test("unitest/test135.c")
def test136ReturnCrustExpectNoCrust(self): def test136ReturnCrustExpectNoCrust(self):
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) ]) 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') ])
def test137ReturnNoCrustExpectCrust(self): def test137ReturnNoCrustExpectCrust(self):
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) ]) 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') ])
def test138OddBreakInFor(self): 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) ]) 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): ...@@ -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") ]) 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): def test166ExpectedNoReturnValueButValueAvailable(self):
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") ]) 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") ])
def test167ExpectedReturnValueEmptyReturn(self): 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) ]) 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): ...@@ -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) ]) 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): def test170ReturnedUninitializedValue(self):
self._generic_test("unitest/test170.c", [ (crust.crust.MSG_ERROR, "Returning variable '{:s}' at line {:d} is uninitialized", "param", 5) ]) 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') ])
def test171IgnoreBorrowReturnValue(self): def test171IgnoreBorrowReturnValue(self):
self._all_fine_test("unitest/test171.c") self._all_fine_test("unitest/test171.c")
...@@ -1001,6 +1001,9 @@ class Test(unittest.TestCase): ...@@ -1001,6 +1001,9 @@ class Test(unittest.TestCase):
def test242CompareWithCrustPointerWithNullUninitialized(self): def test242CompareWithCrustPointerWithNullUninitialized(self):
self._generic_test("unitest/test242.c", [ (crust.crust.MSG_ERROR, "Using uninitialized variable '{:s}' at line {:d}", "p", 7) ]) self._generic_test("unitest/test242.c", [ (crust.crust.MSG_ERROR, "Using uninitialized variable '{:s}' at line {:d}", "p", 7) ])
def test243ReturnVoidPointer(self):
self._all_fine_test("unitest/test243.c")
if __name__ == '__main__': if __name__ == '__main__':
try: try:
os.remove("error_list.txt") os.remove("error_list.txt")
......
void* function_name() {
return 0;
}
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