laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
lint/checkpatch: ignore STATIC_CONST_CHAR_ARRAY

include/osmocom/vty/command.h has the following:

#define DEFUN_CMD_FUNC_DECL(funcname) \
static int funcname (struct cmd_element *, struct vty *, int, const char *[]); \

#define DEFUN_CMD_FUNC_TEXT(funcname) \
static int funcname \
(struct cmd_element *self, struct vty *vty, int argc, const char *argv[])

So the pointer to argv is const, but the elements in the array are not.
Functions can in theory modify the elements of argv (just like argv in
main()). I don't know if we have users of this API that are actually
doing that, but as long as the API is defined like this it doesn't make
sense for the linter to complain about using it correctly. Therefore,
ignore STATIC_CONST_CHAR_ARRAY.

Related: https://gerrit.osmocom.org/c/osmo-bsc/+/42729/comment/f3bc5254_5f30d1bb/
Change-Id: Iae0d3ff4ca648d6a3b6ca0f7805ec18e50befa80
---
M lint/checkpatch/checkpatch_osmo.sh
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/lint/checkpatch/checkpatch_osmo.sh b/lint/checkpatch/checkpatch_osmo.sh
index de14044..50551b0 100755
--- a/lint/checkpatch/checkpatch_osmo.sh
+++ b/lint/checkpatch/checkpatch_osmo.sh
@@ -77,6 +77,7 @@
# * SPDX_LICENSE_TAG: we don't place it on line 1
# * SPLIT_STRING: we do split long messages over multiple lines
# * SSCANF_TO_KSTRTO: kernel specific
+# * STATIC_CONST_CHAR_ARRAY: incompatible with DEFUN_* API from libosmocore
# * STRING_FRAGMENTS: sometimes used intentionally to improve readability
# * SYMBOLIC_PERMS: recommends using octal permissions over symbolic ones, not followed
# * TRACING_LOGGING: recommends to use kernel's internal ftrace instead of printf("%s()\n", __func__)
@@ -116,6 +117,7 @@
--ignore SPDX_LICENSE_TAG \
--ignore SPLIT_STRING \
--ignore SSCANF_TO_KSTRTO \
+ --ignore STATIC_CONST_CHAR_ARRAY \
--ignore STRING_FRAGMENTS \
--ignore SYMBOLIC_PERMS \
--ignore TRACING_LOGGING \

To view, visit change 42731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Iae0d3ff4ca648d6a3b6ca0f7805ec18e50befa80
Gerrit-Change-Number: 42731
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>