From patchwork Sat Feb 29 16:42:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2924 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 50DA262689 for ; Sat, 29 Feb 2020 17:43:24 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E479233E for ; Sat, 29 Feb 2020 17:43:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582994604; bh=2Rz6XO1bXJrYs0sXHFeMDi56iMZxCJgRhR1LvT0iyxg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qLgNf3dOF6Rx5/6K4a/QPY9T+Y8VZcZCezSehwoIOhr+Uw2UMHRr/8Ku6r2PNTbsC YW84bLIOxyxRiWUcWSdA/1tnrUJEgHNxfYxAtoQXHUKgg3CAUjHnqaY2OQPfz9OtYr PELRCYl0Ajdpa5eVQ8vWSVpQD0VKSxLbPOX4qvyA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 29 Feb 2020 18:42:29 +0200 Message-Id: <20200229164254.23604-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200229164254.23604-1-laurent.pinchart@ideasonboard.com> References: <20200229164254.23604-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/31] libcamera: ipa: Test control structure size with static_assert X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Feb 2020 16:43:25 -0000 The control-related structures ipa_controls_header, ipa_control_value_entry and ipa_control_range_entry define the IPA protocol and are thus part of the ABI. To avoid breaking it inadvertently, use static_assert() to check the size of the structures. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/ipa_controls.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp index dd3ff9a0d467..25f38bab3dd9 100644 --- a/src/libcamera/ipa_controls.cpp +++ b/src/libcamera/ipa_controls.cpp @@ -153,6 +153,9 @@ * Reserved for future extensions */ +static_assert(sizeof(ipa_controls_header) == 32, + "Invalid size for struct ipa_control_header"); + /** * \struct ipa_control_value_entry * \brief Description of a serialized ControlValue entry @@ -167,6 +170,9 @@ * value data (shall be a multiple of 8 bytes). */ +static_assert(sizeof(ipa_control_value_entry) == 16, + "Invalid size for struct ipa_control_value_entry"); + /** * \struct ipa_control_range_entry * \brief Description of a serialized ControlRange entry @@ -180,3 +186,6 @@ * \var ipa_control_range_entry::padding * Padding bytes (shall be set to 0) */ + +static_assert(sizeof(ipa_control_range_entry) == 16, + "Invalid size for struct ipa_control_range_entry");