Re: some numbers on macros

From: Matthew Wilcox
Date: Sat May 24 2008 - 14:52:31 EST


On Sat, May 24, 2008 at 09:33:50AM -0700, Arjan van de Ven wrote:
> unused macros in common header files are an indication of stale APIs
> otoh.. and might be of some interest. (Same for static inline in
> headers)

Possibly. There's likely to be a lot of macros unused like these ones:

#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
/* Max # of outstanding split transactions */
#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */
#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */
#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */
...

where the macros embody the PCI specification in code -- possibly we
don't use them yet, but if we ever did, we'd have the macros to use.

Another category of false positive is macros that ought to be used,
but the code that ought to be using them has decided to go its own way.
That still indicates a bug, but not the one you might initially think.

In summary, this is probably an interesting exercise, but the results
would need to be interpreted with care.

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/