Comment 8 for bug 305901

Revision history for this message
Anders Kaseorg (andersk) wrote :

>> pcregrep -M 'sprintf\s*\(\s*([^,]*)\s*,\s*"%s[^"]*"\s*,\s*\1\s*,'
>
> the regexp doesn't search for snprintf, and doesn't look for functions spanning more than one line.

It does with pcregrep -M. For example,

$ pcregrep -M 'sprintf\s*\(\s*([^,]*)\s*,\s*"%s[^"]*"\s*,\s*\1\s*,' \
  linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
  ret += sprintf(buf, "%sEntry: %d\n", buf, i);
  ret += sprintf(buf, "%sReads: %s\tNew Entries: %s\n",
   buf,
  ret += sprintf(buf, "%sSubCache: %x\tIndex: %x\n",
   buf, (reg & 0x30000) >> 16, reg & 0xfff);

However, it appears that the multiline results did not show up in Kees’ reports, so the reports should be rerun with pcregrep -M if that is possible.