|
1 | 1 | Here a few minimalistic coding rules for the CPROVER source tree.
|
2 | 2 |
|
| 3 | +# Interfaces |
| 4 | +- With any changes, consider the impact on other users of the code base. Users |
| 5 | + frequently carry their own set of patches or build tools on top of the code |
| 6 | + base. Large-scale changes negatively impact both scenarios. |
| 7 | +- Tools that link against the code base can reasonably expect a stable |
| 8 | + interface. We consider as public interface any objects, procedures, or classes |
| 9 | + (and their methods) that are meant to be used outside a single directory. |
| 10 | +- See below for how to document interfaces and how to mark parts of interfaces |
| 11 | + as deprecated. |
| 12 | + |
3 | 13 | # Whitespaces
|
4 | 14 |
|
5 | 15 | Formatting is enforced using clang-format. For more information about this, see
|
@@ -101,6 +111,16 @@ Formatting is enforced using clang-format. For more information about this, see
|
101 | 111 | - Use comments to explain the non-obvious
|
102 | 112 | - Use #if 0 for commenting out source code
|
103 | 113 | - Use #ifdef DEBUG to guard debug code
|
| 114 | +- When deprecating interfaces, use the `DEPRECATED` macro, preferably together |
| 115 | + with `SINCE`. For example, |
| 116 | + ``` |
| 117 | + DEPRECATED(SINCE(2019, 1, 31, "use other_method() instead")) |
| 118 | + void deprecated_method(); |
| 119 | + ``` |
| 120 | + marks `deprecated_method` as deprecated as of 2019-01-31. Any deprecated |
| 121 | + functionality should remain in place for at least six months from the date of |
| 122 | + deprecation. Before deprecating code, all in-tree uses should be replaced or |
| 123 | + marked as deprecated. |
104 | 124 |
|
105 | 125 | # Naming
|
106 | 126 | - Identifiers should make clear the purpose of the thing they are naming.
|
|
0 commit comments