I think it is time to modernise the debug logging a bit, this would make our life easier when logging and running make (with the copious warnings compilers will generate unless one passes -Wno-format-extra-args).
The major obstacle to this is the thousands of lines that need adjusting, luckily there is a tool named Coccinelle[0], co-developed with the Linux kernel. It can work with so-called semantic patches and apply them on a code base to prepare a final patch.
The work so far (that seems to pass the same tests that master does on loglevel any) is available here: ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20170714-variadic-debug.tgz
If you want to replicate the generated patches, you will have to use the latest version of Coccinelle from git[1] to have them correctly processed. To help Coccinelle parse OpenLDAP sources, you will also have to pass "--macro-file-builtins macros.h". You can skip 02-shortcut.cocci, but expect to wait a few days before Coccinelle processes some of the more if()fy files if you do so.
Sample command line: spatch --sp-file 01-variadic.cocci --macro-file-builtins macros.h --dir .
If we aim to apply this to master+2.5, we will have the time to stabilise any unexpected fallout before 2.5 is ready since the resulting patches are still rather large. It is probably too late to touch 2.4, however hard it might make to backport any fixes, unless we start to depend on Coccinelle for backporting just like the Linux kernel does.
I welcome your review and suggestions.
[0]. http://coccinelle.lip6.fr/ [1]. https://github.com/coccinelle/coccinelle
On 14. juli 2017 17:23, Ondřej Kuzník wrote:
I think it is time to modernise the debug logging a bit, this would make our life easier when logging and running make (with the copious warnings compilers will generate unless one passes -Wno-format-extra-args).
The major obstacle to this is the thousands of lines that need adjusting, (...)
The obstacle is that we support building OpenLDAP with C90 compilers.
If we ditch that and require a C99 compiler, we can kill annoyances like Debug() extra args. IIRC the answer has been "sigh, not yet" for a long time, I don't remember if it still was last time we talked about it.
(We can still have headers which support C90, so people only need C99 for building.)