Pattern matching

Hi all,
Are there any open source tools for pattern matching of bugs in C/C++ code? both within a file and across files.
Thanks,
Siddharth