Some object types are not meant to be used as a value type in all circumstances, but the language (mainly C) does not provide facilities for marking these types as noncopyable. For instance, you should never pass a FILE object by value, but only by pointer. This seems to fall into two category of types:
A FILE type should never be declared by value (whether as a local, a field, or a parameter) and such a pointer should never be dereferenced.
Some POSIX types, like pthread_mutex_t can be declared by value as a variable or field, but should not be declared by value as a parameter, and such a pointer should never be dereferenced.
This patch adds a checker (misc-non-copyable-objects, but a better moniker would not make me sad) to catch code that does this accidentally. This corresponds (at least for treatment of FILE) to: https://www.securecoding.cert.org/confluence/display/c/FIO38-C.+Do+not+copy+a+FILE+object
~Aaron
How about making these lists configurable or adding a list for custom type names that should be checked in a similar way?