Conversation
The date format needs a % character. Fixes: 8de3676 ("api: generate a single grout.h umbrella header") Signed-off-by: Robin Jarry <rjarry@redhat.com>
Add a GR_API_INLINE macro that normally expands to static inline. In check_api.sh, it is redefined to empty so the compiler emits an external symbol that abidiff can track. For inline functions whose body is part of the API contract (e.g. shared memory ring accessors), compare the disassembly of both revisions with objdump. Since both binaries are built with the same toolchain and flags, any difference is a real code change. Treat removed or changed inline functions as breaking. Signed-off-by: Robin Jarry <rjarry@redhat.com>
📝 WalkthroughWalkthroughThe pull request introduces a new Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@devtools/check_api.sh`:
- Around line 99-100: The branch handling newly added inline API functions (elif
[ -z "$a" ]; then) only echoes "inline API function $func: added" but does not
flip inline_change, so additions of GR_API_INLINE helpers can bypass the
API-change path; update that branch in devtools/check_api.sh to set
inline_change=true (and keep the echo) when func corresponds to a GR_API_INLINE
symbol so the later API-change branch (lines handling inline_change) runs;
reference the elif [ -z "$a" ]; then branch, the inline_change variable, and the
GR_API_INLINE helper/function name ($func) when making this change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 739d44b6-866e-420f-8a7f-1c67f5ad525a
📒 Files selected for processing (3)
api/gr_api.hdevtools/check_api.shdevtools/gen_api_header.sh
| elif [ -z "$a" ]; then | ||
| echo "inline API function $func: added" |
There was a problem hiding this comment.
Added inline API functions currently bypass the change detection path.
Line 99 only logs "added" and leaves inline_change=false. If a PR adds a new GR_API_INLINE helper and abidiff stays quiet, Lines 113-129 never enter the API-change branch, so the new public inline API slips through this check entirely.
Possible fix
-inline_change=false
+inline_change=false
+inline_added=false
while read -r func; do
a=$(objdump -d --disassemble="$func" $dir/check_api/a.bin 2>/dev/null \
| sed -n '/^[0-9a-f].*:/{s/^[^:]*://;s/\t[0-9a-f ]*\t/\t/;p}')
b=$(objdump -d --disassemble="$func" $dir/check_api/b.bin 2>/dev/null \
| sed -n '/^[0-9a-f].*:/{s/^[^:]*://;s/\t[0-9a-f ]*\t/\t/;p}')
if [ -z "$a" ] && [ -z "$b" ]; then
continue
elif [ -z "$a" ]; then
+ inline_added=true
echo "inline API function $func: added"
elif [ -z "$b" ]; then
inline_change=true
echo "inline API function $func: removed"
elif [ "$a" != "$b" ]; then
inline_change=true
echo "inline API function $func: code changed"
fi
done < $dir/check_api/inline_funcs
-if ! $abidiff --non-reachable-types --drop-private-types --show-bytes \
+if ! $abidiff --non-reachable-types --drop-private-types --show-bytes \
--headers-dir1 $dir/check_api/a --headers-dir2 $dir/check_api/b \
- $dir/check_api/a.bin $dir/check_api/b.bin >"$dir/abidiff.log" 2>&1 \
- || [ "$inline_change" = true ]
+ $dir/check_api/a.bin $dir/check_api/b.bin >"$dir/abidiff.log" 2>&1 \
+ || [ "$inline_change" = true ] || [ "$inline_added" = true ]
then📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| elif [ -z "$a" ]; then | |
| echo "inline API function $func: added" | |
| inline_change=false | |
| inline_added=false | |
| while read -r func; do | |
| a=$(objdump -d --disassemble="$func" $dir/check_api/a.bin 2>/dev/null \ | |
| | sed -n '/^[0-9a-f].*:/{s/^[^:]*://;s/\t[0-9a-f ]*\t/\t/;p}') | |
| b=$(objdump -d --disassemble="$func" $dir/check_api/b.bin 2>/dev/null \ | |
| | sed -n '/^[0-9a-f].*:/{s/^[^:]*://;s/\t[0-9a-f ]*\t/\t/;p}') | |
| if [ -z "$a" ] && [ -z "$b" ]; then | |
| continue | |
| elif [ -z "$a" ]; then | |
| inline_added=true | |
| echo "inline API function $func: added" | |
| elif [ -z "$b" ]; then | |
| inline_change=true | |
| echo "inline API function $func: removed" | |
| elif [ "$a" != "$b" ]; then | |
| inline_change=true | |
| echo "inline API function $func: code changed" | |
| fi | |
| done < $dir/check_api/inline_funcs | |
| if ! $abidiff --non-reachable-types --drop-private-types --show-bytes \ | |
| --headers-dir1 $dir/check_api/a --headers-dir2 $dir/check_api/b \ | |
| $dir/check_api/a.bin $dir/check_api/b.bin >"$dir/abidiff.log" 2>&1 \ | |
| || [ "$inline_change" = true ] || [ "$inline_added" = true ] | |
| then |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/check_api.sh` around lines 99 - 100, The branch handling newly added
inline API functions (elif [ -z "$a" ]; then) only echoes "inline API function
$func: added" but does not flip inline_change, so additions of GR_API_INLINE
helpers can bypass the API-change path; update that branch in
devtools/check_api.sh to set inline_change=true (and keep the echo) when func
corresponds to a GR_API_INLINE symbol so the later API-change branch (lines
handling inline_change) runs; reference the elif [ -z "$a" ]; then branch, the
inline_change variable, and the GR_API_INLINE helper/function name ($func) when
making this change.
|
|
||
| echo "// SPDX-License-Identifier: BSD-3-Clause" | ||
| echo "// Copyright (c) $(date +Y) Red Hat" | ||
| echo "// Copyright (c) $(date +%Y) Red Hat" |
API inline function compatibility checking
Extends the API compatibility check (introduced in commit 9e51368) to track and compare inline wrapper functions across revisions.
Changes
api/gr_api.h
Introduces a
GR_API_INLINEmacro conditionally defined asstatic inline. This macro provides a hook for generated request/response wrapper functions to be marked with a specific attribute or section marker.devtools/check_api.sh
Augments the ABI compatibility check with inline function tracking:
-Wno-missing-declarationsand-Wno-missing-prototypesto suppress warnings for generated functionsGR_API_INLINEmacro definition to place inline wrapper functions into a dedicated ELF section (.api_inline).api_inlinesection in both previous and current buildsinline_changeflag when inline functions are added, removed, or their implementation differsdevtools/gen_api_header.sh
Corrects the date format command from
date +Ytodate +%Yto properly output the four-digit year in the copyright notice.