From mboxrd@z Thu Jan 1 00:00:00 1970 From: okuznik@symas.com (=?utf-8?B?T25kxZllaiBLdXpuw61r?=) Date: Tue, 11 Jul 2017 14:06:41 +0100 Subject: [Cocci] Matching format strings In-Reply-To: References: <20170705162516.jyqinnwnfqjwuskg@eos.mistotebe.net> <20170710161224.rbqo4drhcfqosh23@eos.mistotebe.net> <20170710162835.xnkjn7btb3cwplsy@eos.mistotebe.net> Message-ID: <20170711130640.heuc3m4mca7vxy52@eos.mistotebe.net> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On Mon, Jul 10, 2017 at 07:26:36PM +0200, Julia Lawall wrote: > Try running spatch --parse-c on your directory to get a list at the end of > the top 10 things it doesn't like. One of the system dependent macros SLAP_EVENT_DECL is listed in each of the 10 things. The macro is used in https://github.com/openldap/openldap/blob/master/servers/slapd/daemon.c#L2343 to declare some variables used in the corresponding event loop. The macro definition looks like this: # define SLAP_EVENT_DECL struct pollfd *revents or: # define SLAP_EVENT_DECL fd_set readfds, writefds; char *rflags Ignoring this macro is OK I guess, if there is a way to do that with coccinelle? Also, moving onto the other patch, I get similar inconsistencies with ./servers/slapd/back-sql/add.c, --parse-c doesn't list any problematic statements but the output logs a few parse errors that don't make much sense to me. Thanks, Ondrej > On Mon, 10 Jul 2017, Ond?ej Kuzn?k wrote: >> On Mon, Jul 10, 2017 at 06:18:14PM +0200, Julia Lawall wrote: >>> On Mon, 10 Jul 2017, Ond?ej Kuzn?k wrote: >>>> Thanks, good thing is make test now seems to pass for the first round of >>>> patches. >>>> >>>> Actually, I'm now having a similar issue with ./servers/slapd/daemon.c, >>>> spatch --parse-c will complain about the SLAP_EVENT_DECL macro and I can >>>> see other issues with LDAP_LIST/LDAP_STAILQ/... macros in the output. >>>> >>>> This patch is the one that's affected (among others), it will make some >>>> changes, applying them and then running it again will make more until >>>> eventually managing to pick up most or all of the ones that I'd expect: >>>> >>>> @@ >>>> format list[2] fmt; >>>> expression list[2] args; >>>> expression E; >>>> @@ >>>> >>>> Debug( E, "%@fmt@", args >>>> -, 0 >>>> ); >>>> >>>> @@ >>>> format list[1] fmt; >>>> expression list[1] args; >>>> expression E; >>>> @@ >>>> >>>> Debug( E, "%@fmt@", args >>>> -, 0, 0 >>>> ); >>>> >>>> @@ >>>> expression E, S; >>>> @@ >>>> >>>> Debug( E, S >>>> -, 0, 0, 0 >>>> ); >>>> >>>> Is there a way to work around that somehow? >>> >>> I'm not sure to understand the relation between the macro problem and the >>> need to iterate. >> >> The above patch will make some changes but not all (even though the >> patch is idempotent) but iteration seems to help. It seems that it's >> because spatch does not like the file (or rather some of the macros >> there). >> >> -- >> Ond?ej Kuzn?k >> Senior Software Engineer >> Symas Corporation http://www.symas.com >> Packaged, certified, and supported LDAP solutions powered by OpenLDAP >> -- Ond?ej Kuzn?k Senior Software Engineer Symas Corporation http://www.symas.com Packaged, certified, and supported LDAP solutions powered by OpenLDAP