Embedded systems are ubiquitously programmed using the C programming language. As some of these systems perform tasks important to safety (viz. Cruise Control in Cars, Automation in Power Plants etc), a major requirement of the software for these systems is absence of any runtime errors. A method of assuring excellent code quality is through strict adherence to pre-established programming guidelines.
The purpose of this challenge is to develop a framework that takes as inputs
- A C program
- A set of programming guidelines from the user and checks if the given program follows the given set of programming guidelines. Any fragment of the program that do not satisfy these guidelines should be identified and flagged.
Example guidelines include:
- There should not be unsafe type conversions such as “float” to “integer”, “int” to “char” etc.
- Statements that evaluate differently left to right and right to left should not be allowed. eg: statements like a = b[j] + j++;
- Bitwise operations are not allowed on signed data types.
- Assignment statements in expressions resulting in Boolean value are not allowed. eg: if( b = a)
- Comparisons between floating point values are not allowed.
4. Global variables in function parameters are not allowed. It is required to develop a framework called as “Ccheck” in which the programming guidelines will be given as a file and input program in a separate file. The challenge is to output the same program file with coloured annotation (either in text editor or web browser) where it violates the specified guidelines. The interface should be something like this
Ccheck < Specification file> < input program file> -o <output program file>
The team may use any open source software components such as CLANG/LLVM/FLEX-BISON etc., to build such a tool on Linux OS.
Sample Data: Yes; contact Shri A.K. Bhattacharya, firstname.lastname@example.org