Commit Graph

8 Commits

Author SHA1 Message Date
Oliver Smith 444ca841e6 lint: checkpatch.pl: fix && complaints
Don't complain with:
	ERROR:SPACING: space prohibited after that '&&' (ctx:ExW)
in code similar to:
	if (conn->conn->mode != MGCP_CONN_LOOPBACK
	    && conn->conn->mode != MGCP_CONN_RECV_ONLY
	    && !mgcp_rtp_end_remote_addr_available(&conn->end)) {

The check was supposed to complain about spaces if the && is used as
unary operator (to get the address of a goto label). But it's clearly
producing false positives in the Osmocom context with use as non-unary
operator, so remove this check.

Related: OS#5087
Related: 0d413866c7
Change-Id: I7ce79e6b291b3a3dab6587a589eeef0a0bc53de9
2021-07-07 11:28:38 +02:00
Oliver Smith 5409188d55 lint: ignore LINE_CONTINUATIONS
Causes false positives, e.g. in tests/mgcp/mgcp_test.c in osmo-mgw:

  #define MDCX4_PT2 \
	"MDCX 18983218 1@mgw MGCP 1.0\r\n" \
	"M: sendrecv\r" \
	"C: 2\r\n" \
	"I: %s\r\n" \
	"L: p:20-20, a:AMR, nt:IN\r\n" \
	...

tests/mgcp/mgcp_test.c:189: WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations

Related: OS#5087
Change-Id: I8d8004f2a8ef926588487187af7cdef8254c7248
2021-07-07 11:28:38 +02:00
Oliver Smith 2cceff4535 lint: ignore COMPLEX_MACRO
Complains about, for example:
  #define MDCX4 \
	"MDCX 18983217 1@mgw MGCP 1.0\r\n" \
	"M: sendrecv\r" \
	"C: 2\r\n" \
	"I: %s\r\n" \
	"L: p:20, a:AMR, nt:IN\r\n" \
	"\n" \
	"v=0\r\n" \
	"o=- %s 23 IN IP4 5.6.7.8\r\n" \
	"c=IN IP4 5.6.7.8\r\n" \
	"t=0 0\r\n" \
	"m=audio 4441 RTP/AVP 99\r\n" \
	"a=rtpmap:99 AMR/8000\r\n" \
	"a=ptime:40\r\n"

Related: OS#5087
Change-Id: Ic9d752ca841161a62e3631c84b4237a0d8594363
2021-07-07 11:28:38 +02:00
Oliver Smith 497ce6743a lint: exclude *.ok, *.err
Complains about e.g. \r\n in *.ok files.

Related: OS#5087
Change-Id: I79004cec3e2eb753951a7f886318ac0db4ea2c06
2021-07-07 11:28:37 +02:00
Oliver Smith 57804faacc lint: checkpatch.pl: exclude pattern, not dir
Allow to exclude files in a follow-up commit, not just directories.

Related: OS#5087
Change-Id: Ic3990fba60060c331c479174183924b9cdbdb4c8
2021-07-07 11:28:16 +02:00
Oliver Smith 1e750ed6dc lint/checkpatch: add Osmocom specific wrapper
Related: OS#5087
Change-Id: I0ec6a3bc57a4d31c821fa83370f05c6d4ac2a5b0
2021-06-16 16:42:18 +02:00
Oliver Smith 6c497c076b lint/checkpatch: add --exclude argument
Apply patch from https://review.coreboot.org/c/coreboot/+/18568/, so we
can exclude specific directories.

Related: OS#5087
Change-Id: Ia980814895249f839873c5002f0d21c0e59ee01d
2021-06-16 16:42:18 +02:00
Oliver Smith 47ba23b820 lint/checkpatch: import from Linux kernel
Prepare to run checkpatch on patches submitted to gerrit to point out
various linting errors automatically, such as { after functions not
placed on a new line, or common spelling errors.

Import version from 7e6cdd7f ("checkpatch: improve ALLOC_ARRAY_ARGS test")
of linux.git.

Related: OS#5087
Related: https://osmocom.org/projects/cellular-infrastructure/wiki/Linting
Change-Id: I58571a0409e79d88d37e8328f41a540a58cfb198
2021-06-16 16:41:56 +02:00