Print this page
patch cstyle-atomic

*** 21,33 **** # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # - # @(#)cstyle 1.58 98/09/09 (from shannon) - #ident "%Z%%M% %I% %E% SMI" - # # cstyle - check for some common stylistic errors. # # cstyle is a sort of "lint" for C coding style. # It attempts to check for the style used in the # kernel, sometimes known as "Bill Joy Normal Form". --- 21,30 ----
*** 630,639 **** --- 627,642 ---- err("blank after preprocessor #"); } if (/!\s*(strcmp|strncmp|bcmp)\s*\(/) { err("don't use boolean ! with comparison functions"); } + if (/\batomic_add_(8|16|32|64|char|short|int|long)\([^,]*,\s*1\)/) { + err("use atomic_inc_*(...) instead of atomic_add_*(..., 1)"); + } + if (/\batomic_add_(8|16|32|64|char|short|int|long)\([^,]*,\s*-1\)/) { + err("use atomic_dec_*(...) instead of atomic_add_*(..., -1)"); + } # # We completely ignore, for purposes of indentation: # * lines outside of functions # * preprocessor lines