Commit 1334e3e4 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

check_format: add test for __attribute__((packed))



For more explaination see 075d422f and a74fcd0b.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ib88d37f117178356bfc693bbce9f9de8455cac5b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18612


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent dff98e73
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -398,6 +398,27 @@ function check_opts_structs() {
	fi
}

function check_attr_packed() {
	local out

	# For now, we only care about the packed attribute in selected files.  We only check those
	# used by Timberland (see https://github.com/timberland-sig), as they're using msvc, which
	# doesn't support the __attribute__ keyword.
	if out=$(git grep -In '__attribute__((packed))' \
		'include/spdk/nvme*.h' \
		'include/spdk/sock.h' \
		'include/spdk_internal/nvme*.h' \
		'lib/nvme' 'lib/sock'); then
		cat <<- WARN
			Found forbidden __attribute__((packed)).  Try to pack the structures manually or
			use #pragma pack instead.

			$out
		WARN
		return 1
	fi
}

function check_python_style() {
	local rc=0

@@ -804,6 +825,7 @@ check_posix_includes || rc=1
check_naming_conventions || rc=1
check_include_style || rc=1
check_opts_structs || rc=1
check_attr_packed || rc=1
check_python_style || rc=1
check_bash_style || rc=1
check_bash_static_analysis || rc=1