checkedc / checkedc-llvm-project

This repo contains a version of clang that is modified to support Checked C. Checked C is an extension to C that lets programmers write C code with bounds checking and improved type-safety.
13 stars 19 forks source link

Checked Qualifier Support #1198

Closed arunkumarbhattar closed 1 year ago

arunkumarbhattar commented 1 year ago

Title: Add Test Suite for Backward Compatibility Syntax and Macros

Description: This PR adds a comprehensive test suite to verify the correct implementation of the alternate syntax and macros introduced for enhancing backward compatibility of Checked C code with non-Checked C compilers, as proposed in this wiki page. The test suite covers the following key aspects:

Pointer types: Test cases to validate the proper functioning of _Array, _Nt_array, and _Single qualifiers for pointer types. Arrays: Verify that the _Checked keyword behaves as expected when a compiler does not support Checked C. Generic types: Validate the correct functioning of the _TyArg and _TyVar macros, as well as the two-part approach for generic function definitions and generic struct definitions. Bounds annotations: Validate the new keywords _Any, _Bounds, _Byte_count, and _Count for bounds expressions, and test cases for declarators followed by bounds expressions. Dynamic check expressions: Test cases to ensure the correct evaluation of dynamic check expressions and their compatibility with the assert macro. Bounds cast expressions: Validate the functioning of variadic macros for _Dynamic_bounds_cast and _Assume_bounds_cast expressions, and their correct mapping to syntax forms or C-style casts. Where clauses: Test cases for where clauses with optional parentheses, and the proper discarding of the where clause body when Checked C is not supported. The test suite ensures that the alternate syntax and macros introduced for backward compatibility function correctly and maintain the safety guarantees of Checked C code, improving code portability and platform compatibility. *****REGRESSION SANITY** Clang Regression sanity tests (TARGET: check-clang):

Testing Time: 2216.67s Unsupported : 74 Passed : 27667 Expectedly Failed: 34

CheckedC regression sanity test (TARGET: check-checkedc) checkedc :: checkedc/tests/typechecking/pointer_types.c
Testing Time: 17.55s Unsupported: 3 Passed : 96

Testing Time: 3170.01s Unsupported : 734 Passed : 69511 Expectedly Failed: 193 Failed : 12

Untouched version was failing 10 test cases. Checking the RC behind the two extra failed TCs. Mostly could be a VM issue. *****REGRESSION SANITY**

dtarditi commented 1 year ago

@arunkumarbhattar Is this subsumed.by PR #1199? It looks it is. If so, we should close this PR.