From mboxrd@z Thu Jan 1 00:00:00 1970 From: okuznik@symas.com (=?utf-8?B?T25kxZllaiBLdXpuw61r?=) Date: Tue, 4 Jul 2017 18:46:33 +0100 Subject: [Cocci] Matching format strings In-Reply-To: References: <20170704160123.lilble53tmv5t5va@eos.mistotebe.net> <20170704162732.urhtl54j3gbj3myh@eos.mistotebe.net> <20170704165655.yu7wwg7aomihs4of@eos.mistotebe.net> Message-ID: <20170704174632.v7ibsesdtquktbjs@eos.mistotebe.net> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On Tue, Jul 04, 2017 at 06:59:39PM +0200, Julia Lawall wrote: >>> How about adding a timeout (eg --timeout 120) and then see how much is >>> left over. >> >> I get: >> timeout (we abort) >> Fatal error: exception Common.Timeout >> >> and no patch is produced, if I wait the 1028 seconds, I get the expected >> patch. I think that supports your hypothesis about trying to process the >> continue. > > If you run Coccinelle on the whole directory, it should timeout on some > files, and then work on the other ones. Indeed, if there is a timeout at > one point for a file then you won't get any patch for that file at all. Ah, OK, I understand the suggestion now. It does speed up the initial testing of the patch over the codebase. Looking at some of the code (well, comments rather), coccinelle is building a CTL formula and a state machine for the C file and tries to find the states where it matches? Is that correct? Does it try to compress the state machine based on the predicates involved? BDDs tend to be rather helpful with CTL model checking. Not sure how useful that is, depending on the information that needs to be extracted (and I've not touched model checking in ages). Sorry if this is completely wrong. I vaguely remember seeing something like this somewhere, but can't find it anymore. That might simplify the three-pronged construction I use into a single patch hunk like the below. Is there a construction like that available or have I just dreamed that up? @@ (stuff here also contains format1, format2, args_before and others as usual) identifier merged : python merge_formats(format1, format2, args_before); @@ -snprintf( buf, E, format1, args ); -Debug( L, format2, args_before, buf, args_after ); +Debug( L, merged, args_before, args, args_after ); -- Ond?ej Kuzn?k Senior Software Engineer Symas Corporation http://www.symas.com Packaged, certified, and supported LDAP solutions powered by OpenLDAP