Issue 8731 - Variadic Debug() macro
Summary: Variadic Debug() macro
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.5.4
Hardware: All All
: --- normal
Target Milestone: 2.5.0
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-12 12:55 UTC by Ondřej Kuzník
Modified: 2020-10-14 21:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ondřej Kuzník 2017-09-12 12:55:19 UTC
Full_Name: Ondrej Kuznik
Version: master
OS: 
URL: ftp://ftp.openldap.org/incoming/debug_macro_refactor.tgz
Submission from: (NULL) (82.10.24.68)


The patch series in the linked archive changes the logging macros to be fully
variadic:
- 00-fixes.patch - fixes proposed in ITS#8730
- 01-logging.patch updates the macros themselves
- 02-manual.patch updates some legal but unnecessary constructs
- 03-variadic.patch (generated from 03-variadic.cocci against today's master
20e46d84948be3127f6145d4f65437091bb87580) replaces the current Debug(level,
"fmt", 0, 0, 0) with Debug(level, "fmt"), etc.
- 04-back-sql.patch updates parts of back-sql that coccinelle cannot currently
process
- 05-nssov.patch updates nssov where coccinelle cannot see past some of the
macros
- 06-shortcut.patch (generated from 06-shortcut.cocci) replaces the
snprintf(buf);Debug("fmt", buf) workaround with Debug()
- 07-snprintf-manual.patch updates what coccinelle cannot pick up without
08-merge.cocci
- (nonexistent 08-merge.patch which would be generated by 08-merge.cocci if it
could process servers/slapd/back-asyncmeta/search.c without timing out)

Where a corresponding .cocci file is present, the patch has been generated with
coccinelle[0] as of commit 42e4638bfacf13ab1a8acc35b40e216e34087578. To
regenerate them (perhaps against a different OpenLDAP branch), the following
command line can be used:

spatch --timeout 300 --macro-file-builtins macros.h -dir --sp-file <cocci file>
--dir .

This will generate a patch on stdout, or, with "--in-place", will effect the
changes directly on the source tree. The existence of 06-shortcut.cocci would
not normally be necessary if the organisation of the file
servers/slapd/back-meta/search.c did not cause coccinelle to take days to
process it. This file is included for anyone trying to make sure the cleanup is
complete even when some of the things that hold in OpenLDAP's master branch
would not. Because of an oversight, this also means 08-merge.cocci does not
perform all the clean up that 06-shortcut.cocci does and would need to be
transplanted.

The attached file is derived from OpenLDAP Software. All of the modifications to
OpenLDAP Software represented in the following patch(es) were developed by
Ond&#345;ej Kuzn�k <okuznik@symas.com>. I have not assigned rights and/or
interest in this work to any party.

The attached semantic patches and modifications to OpenLDAP Software are
subject
to the following notice:

Copyright 2017, Ond&#345;ej Kuzn�k <okuznik@symas.com>, Symas Corporation

Redistribution and use in source and binary forms, with or without modification,
are permitted only as authorized by the OpenLDAP Public License.
Comment 1 Ondřej Kuzník 2017-09-15 15:29:57 UTC
On Tue, Sep 12, 2017 at 12:55:20PM +0000, okuznik@symas.com wrote:
> The patch series in the linked archive changes the logging macros to
> be fully variadic:

Hi Kurt,
the only opposition to going ahead with a change like this I can find[0]
has been based on the fact we'd be dropping support for C90 and it is
your voice that puts concrete arguments forward as a reason for this.

It would seem that no notable platforms remain where the host compiler
would not be able to cope. With that in mind, might I suggest we decide
it is time to require C99 support from 2.5 onwards?

Thanks,

[0] http://www.openldap.org/lists/openldap-devel/200801/msg00059.html

-- 
Ondřej Kuzník
Senior Software Engineer
Symas Corporation                       http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP

Comment 2 Ondřej Kuzník 2018-06-06 16:54:09 UTC
On Tue, Sep 12, 2017 at 12:55:20PM +0000, okuznik@symas.com wrote:
> The patch series in the linked archive changes the logging macros to be fully
> variadic:

There is a new archive at:
ftp://ftp.openldap.org/incoming/debug_macro_refactor_v2.tgz

This addresses concerns that it should still be possible to build
libldap (only) on compilers that might not support variadic macros. All
patches are generated from the attached .cocci files against current
master (commit 9069cbe543d079e9d7f55162decb8e732fc32338).

I would welcome some review of the patch 01-logging.patch, which
consists of the actual implementation. Rest is just to bring OpenLDAP up
to scratch.

At the end of the series, OpenLDAP seems to compile with CFLAGS
containing -Werror=format-extra-args.

-- 
Ondřej Kuzník
Senior Software Engineer
Symas Corporation                       http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP

Comment 3 Quanah Gibson-Mount 2020-04-13 19:06:36 UTC
  • bbe20cbf 
by Ryan Tandy at 2020-04-13T18:57:50+00:00 
ITS#8731 cleanup unused logbuf