All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] OpenLDAP debug statements
@ 2017-08-29 15:08 Ondřej Kuzník
  2017-08-29 19:14 ` Julia Lawall
  2017-08-29 21:17 ` Julia Lawall
  0 siblings, 2 replies; 15+ messages in thread
From: Ondřej Kuzník @ 2017-08-29 15:08 UTC (permalink / raw)
  To: cocci

Hi again,
having achieved some consensus to go ahead with this in the project and
some time to spare again, I have started on refining the patch to get as large
part of the OpenLDAP source code converted as possible.

There seem to be a few hundred occurrences that I can't seem to get
coccinelle to process, a few too many to process manually (by an order
of magnitude).

An example file with the most is servers/slapd/back-sql/add.c (55
instances of the Debug macro that should get some arguments dropped but
don't). Like others, spatch --parse-c finds no issues with the file.

Is there some way to improve the patch to get the false negatives down?

These are the instances I would expect removed (including the 9 that do
get picked up):
------8<-------
@@
expression E, E1, E2, S;
@@

Debug( E, S, E1, E2
*, 0
 );
------8<-------

This is the patch:
------8<-------
@@
identifier Logs =~ "Log[0-9]";
@@
-Logs
+Log

@@
@@
-StatslogTest
+LogTest

@@
format list[2] fmt;
expression list[2] args;
expression E;
@@

Debug( E, "%@fmt@", args
-, 0
 );

@@
format list[2] fmt;
expression list[2] args;
expression E;
@@

Debug( E, "%@fmt@", args
-, NULL
 );

@@
format list[1] fmt;
expression list[1] args;
expression E;
@@

Debug( E, "%@fmt@", args
-, 0, 0
 );

@@
format list[1] fmt;
expression list[1] args;
expression E;
@@

Debug( E, "%@fmt@", args
-, NULL, NULL
 );

@@
expression E, S;
@@

Debug( E, S
-, 0, 0, 0
 );

@@
expression E, S;
@@

Debug( E, S
-, NULL, NULL, NULL
 );

@@
format list[5] fmt;
expression list[5] args;
expression E;
@@

-Statslog
+Debug
 ( E, "%@fmt@", args );

@@
format list[4] fmt;
expression list[4] args;
expression E;
@@

-Statslog
+Debug
 ( E, "%@fmt@", args
-, 0
 );

@@
format list[3] fmt;
expression list[3] args;
expression E;
@@

-Statslog
+Debug
 ( E, "%@fmt@", args
-, 0, 0
 );

@@
format list[2] fmt;
expression list[2] args;
expression E;
@@

-Statslog
+Debug
 ( E, "%@fmt@", args
-, 0, 0, 0
 );

@@
format list[1] fmt;
expression list[1] args;
expression E;
@@

-Statslog
+Debug
 ( E, "%@fmt@", args
-, 0, 0, 0, 0
 );

@@
expression E, S;
@@

-Statslog
+Debug
 ( E, S
-, 0, 0, 0, 0, 0
 );

@@
identifier Stats =~ "^Statslog";
@@
(
 StatslogEtime
|
-Stats
+Debug
)
------8<-------

And this is the macro file I use:
------8<-------
#define LDAP_PF_LOCAL_SENDMSG_ARG(x)

#define LDAP_P(x) x
#define LDAP_F(x) extern x
#define LDAP_V(x) extern x

#define LDAP_GCCATTR(x)                                 
#define LDAP_XSTRING(x) ""                              
#define LDAP_CONCAT(x,y) x                              

#define LDAP_CONST const                                
#define LDAP_BEGIN_DECL                                 
#define LDAP_END_DECL                                   

#define SLAP_EVENT_DECL                                 
#define SLAP_EVENT_FNAME

#define BACKSQL_ARBITRARY_KEY
#define BACKSQL_IDNUMFMT "%llu"
#define BACKSQL_IDFMT "%s"
#define BACKSQL_IDARG(arg) ((arg).bv_val)
------8<-------

Thanks,

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-08-31 16:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 15:08 [Cocci] OpenLDAP debug statements Ondřej Kuzník
2017-08-29 19:14 ` Julia Lawall
2017-08-29 21:17 ` Julia Lawall
     [not found]   ` <WM!749c3f172b3974a95a60915dcb92be0a7c29793379a0cf5b8c9fa31b26724555bb6748424359219db0307c72c35963de!@mailstronghold-1.zmailcloud.com>
2017-08-29 22:15     ` Ondřej Kuzník
2017-08-30  5:25       ` Julia Lawall
     [not found]         ` <WM!d9b0a1156da6c99c9820ebef21a59a8a89d121069b7a3992c73cc9e3056bf05f3193ceae9e855747b5cba0f4c7a73e77!@mailstronghold-3.zmailcloud.com>
2017-08-30 12:50           ` Ondřej Kuzník
2017-08-30 13:05             ` Julia Lawall
     [not found]               ` <WM!31a93b9eaa05d271c5e490fb8cbf454d71a531b19f3453d107ecb7e19adb99d108c14ee93b5774c82e15694f7e635331!@mailstronghold-2.zmailcloud.com>
2017-08-31 13:37                 ` Ondřej Kuzník
2017-08-31 14:09                   ` Julia Lawall
     [not found]                     ` <WM!dd59490e5b7de329073fb77c10065fccac3a9a41edb3acd8e86e03476c313ec5bb332d1b5b82bbc9f3c9941991f2c2e3!@mailstronghold-1.zmailcloud.com>
2017-08-31 15:46                       ` Ondřej Kuzník
2017-08-31 15:52                         ` Julia Lawall
     [not found]                           ` <WM!a89a77e54968f94897ce9cfdcde91fbafe11503103440c35bc96b5b7348b143240bee9daf49db5256b5b922355576b8f!@mailstronghold-1.zmailcloud.com>
2017-08-31 15:56                             ` Ondřej Kuzník
2017-08-31 16:01                               ` Julia Lawall
     [not found]                                 ` <WM!dc7736266ab751636f2d1292c87d4c5cc5827df1e313d7788da99c4b8733ee5da91cdaf5189368ed6790a6408e97c69c!@mailstronghold-2.zmailcloud.com>
2017-08-31 16:45                                   ` Ondřej Kuzník
2017-08-31 16:47                                     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.