--- a/contrib/check-code.py Sat Mar 19 20:02:19 2016 -0400
+++ b/contrib/check-code.py Sat Mar 19 20:18:38 2016 -0400
@@ -359,6 +359,7 @@
(r'^#\s+\w', "use #foo, not # foo"),
(r'[^\n]\Z', "no trailing newline"),
(r'^\s*#import\b', "use only #include in standard C code"),
+ (r'strcpy\(', "don't use strcpy, use strlcpy or memcpy"),
],
# warnings
[]
--- a/tests/test-contrib-check-code.t Sat Mar 19 20:02:19 2016 -0400
+++ b/tests/test-contrib-check-code.t Sat Mar 19 20:18:38 2016 -0400
@@ -69,6 +69,22 @@
dict() is different in Py2 and 3 and is slower than {}
[1]
+ $ cat > foo.c <<EOF
+ > void narf() {
+ > strcpy(foo, bar);
+ > // strcpy_s is okay, but this comment is not
+ > strcpy_s(foo, bar);
+ > }
+ > EOF
+ $ "$check_code" ./foo.c
+ ./foo.c:2:
+ > strcpy(foo, bar);
+ don't use strcpy, use strlcpy or memcpy
+ ./foo.c:3:
+ > // strcpy_s is okay, but this comment is not
+ don't use //-style comments
+ [1]
+
$ cat > is-op.py <<EOF
> # is-operator comparing number or string literal
> x = None