From e2b5f7f74878da7ac1beba2c33b35b47b5bfcf17 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Fri, 31 Jul 2026 10:48:25 -0500 Subject: [PATCH] Improve C ABI struct change error handling Signed-off-by: James Bourbeau --- ci/check_c_abi/check_c_abi/abi.py | 3 ++- ci/check_c_abi/check_c_abi/tests/test_abi.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/check_c_abi/check_c_abi/abi.py b/ci/check_c_abi/check_c_abi/abi.py index e235a002bc..069bb19ae4 100644 --- a/ci/check_c_abi/check_c_abi/abi.py +++ b/ci/check_c_abi/check_c_abi/abi.py @@ -1,5 +1,5 @@ # -# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # @@ -287,6 +287,7 @@ def _analyze_struct_abi( symbol=name, location=old_struct.location, ) + continue for (old_type, old_name), (new_type, new_name) in zip_longest( old_struct.members, diff --git a/ci/check_c_abi/check_c_abi/tests/test_abi.py b/ci/check_c_abi/check_c_abi/tests/test_abi.py index d0baf22ad5..a9db0c2d92 100644 --- a/ci/check_c_abi/check_c_abi/tests/test_abi.py +++ b/ci/check_c_abi/check_c_abi/tests/test_abi.py @@ -1,5 +1,5 @@ # -# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # @@ -65,6 +65,13 @@ def test_struct(): errors = analyze_c_abi(old_abi, old_abi) assert not errors + # removing a struct should return an error + new_abi = abi_from_str("") + errors = analyze_c_abi(old_abi, new_abi) + assert len(errors) == 1 + assert errors[0].symbol == "Foo" + assert errors[0].error == "Struct has been removed" + # removing a field should return an error new_abi = abi_from_str(""" struct Foo {