| 1 |
Most of the project now depends on the compiler supporting C99 variadic |
| 2 |
macros. This is used in the Debug() macro everywhere except libldap and |
| 3 |
its dependencies. |
| 4 |
|
| 5 |
From now on, any time Debug( level, fmt, args... ) is used, you can and |
| 6 |
should provide the appropriate number of arguments. The coccinelle |
| 7 |
patches in this directory implement the transformations used to bring |
| 8 |
the project in line with this. |
| 9 |
|
| 10 |
As we still aim to support libldap on platforms that only provide C89, |
| 11 |
Debug0/1/2/3 macros are used instead. |
| 12 |
|
| 13 |
If you need to adapt your own fork, see ITS#8731, the rest of this |
| 14 |
README and scripts in this directory on what you'll need to achieve |
| 15 |
this. |
| 16 |
|
| 17 |
Coccinelle as of git hash e65a7bdc04ac9122acdae2353422c5736b7998ba from |
| 18 |
https://github.com/coccinelle/coccinelle has been used to run the |
| 19 |
transformations performed. One notable limitation at the time of writing |
| 20 |
is that multi-part (format) strings are always merged onto the same line. |
| 21 |
|
| 22 |
Some sources cannot be processed, nssov overlay being a prime example, |
| 23 |
being wrapped in non-trivial macros. |
| 24 |
|
| 25 |
The following semantic patches are involved: |
| 26 |
- 03-libldap_Debug.cocci: converts the libraries to use the Debug[0123] |
| 27 |
macros as appropriate |
| 28 |
- 04-variadic.cocci: converts the rest of the project to use the Debug |
| 29 |
macro with the right number of arguments (as opposed to padding with |
| 30 |
zeroes) |
| 31 |
- 09-merge.cocci will merge an 'snprintf(s, len, "fmt", args...); |
| 32 |
Debug(level, "... %s ...", ..., s, ...);' sequence together |
| 33 |
- 07-shortcut.cocci is actually used to apply the above since |
| 34 |
coccinelle's model-checker seems to struggle with state space |
| 35 |
explosion in some of the very long and complex functions we have - |
| 36 |
09-merge.cocci doesn't finish in any reasonable time |
| 37 |
|
| 38 |
The equivalence.iso and macros.h files aid coccinelle to parse our |
| 39 |
sources correctly and simplify the semantic patches. |