Hi Jim,

Am 21.01.2016 um 15:35 schrieb Jim Jagielski:
BTW, do you have pointers on how to use your "new" Coccinelle/spatch
script to assign AH log numbers?

first I had to build OCAML and coccinelle (which provides spatch) on Solaris. As usual not much fun. I assume, you can find ready-to-go packages for those in your favorite Linux package repos. So I spare you those details.

Then I followed the simple description in docs/log-message-tags/README, especially running

DIR=docs/log-message-tags
spatch -sp_file $DIR/find-messages.cocci \
-in_place \
-macro_file $DIR/macros.h FILESTOCHECK

where FILESTOCHECK is the list of C files you want spatch to work on.

The spatch patch (the cocci file) adds "APLOGNO()," to all eligible log statements it identifies. To finally replace the empty "APLOGNO()," with a real number, I ran

perl docs/log-message-tags/update-log-msg-tags FILESTOFIX

It will put real numbers in and update docs/log-message-tags/next-number.

There's also a make task, which I didn't use.

If your version of spatch (coccinelle) isn't build with pcre support (mine on Solaris wasn't) you need to fix the docs/log-message-tags/find-messages.cocci file. In all lines defining a regexp (look for "=~") replace all "|" by "\|" and all "(" resp. ")" with "\(" and "\)" because that is the default regexp style in ocaml.

HTH!

Regards,

Rainer

Reply via email to