|
|
# Blocks with 1 statement
|
|
|
# Blocks with 1 statement
|
|
|
|
|
|
- The body of an if condition should at preferably have brackets. If the body has just one statement you may leave out the `{}` but in that case put the statement indented on another line. Also only do this if you think it unlikely that you will add more statements to the body later.
|
|
|
|
|
|
**OK:**
|
... | ... | @@ -15,4 +16,41 @@ if ((flags & STMT_BLOCK_RETURN_F) && !parse_error) { |
|
|
|
|
|
```c
|
|
|
if (flags & STMT_BLOCK_RETURN_F) ret = TCappendAssign (ret, ret_stmt);
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
```
|
|
|
|
|
|
# Info struct accessor macros
|
|
|
|
|
|
You should not access the fields on the info struct in traversals directly but access it with a macro.
|
|
|
This allows you to potentially change the place your attribute is stored on the original info struct.
|
|
|
|
|
|
The macros should follow the format `INFO_<FIELD_NAME>()`
|
|
|
|
|
|
# Function definitions
|
|
|
|
|
|
Write a function definition like this:
|
|
|
|
|
|
```c
|
|
|
keywords type
|
|
|
name()
|
|
|
{
|
|
|
...
|
|
|
}
|
|
|
```
|
|
|
|
|
|
The keywords and return type first and then on another line the name and arguments.
|
|
|
The `{` goes below the function name.
|
|
|
|
|
|
|
|
|
## Example:
|
|
|
|
|
|
```c
|
|
|
static inline void
|
|
|
destroy_mutex_barrier (void)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
Also do not forget to make a doc string with a `@brief` and a description of what the functnion does
|
|
|
and preferably some examples if. |