Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix MakeFunctionCallable's codegen when return type is a function pointer #502

Conversation

Vipul-Cariappa
Copy link
Collaborator

Description

Fixes code generation of MakeFunctionCallable for the cases where the return type of the function is a function pointer.

Fixes # (issue)

Potentially fix 4 tests at cppyy.

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Implemented a test case where it used to fail, but passed with these changes.

Checklist

  • I have read the contribution guide recently

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -920,6 +926,12 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
FCI4.Invoke(&ret4);
EXPECT_EQ(ret4, 4);

typedef int (*int_func)(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant void argument list in typedef [modernize-redundant-void-arg]

Suggested change
typedef int (*int_func)(void);
typedef int (*int_func)();

@@ -920,6 +926,12 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
FCI4.Invoke(&ret4);
EXPECT_EQ(ret4, 4);

typedef int (*int_func)(void);
int_func callback = nullptr;
FCI5.Invoke(&callback);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: multilevel pointer conversion from 'int_func *' (aka 'int (**)()') to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]

  FCI5.Invoke(&callback);
              ^

Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.63%. Comparing base (fc852d5) to head (2b096c7).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #502      +/-   ##
==========================================
+ Coverage   71.26%   71.63%   +0.36%     
==========================================
  Files           9        9              
  Lines        3564     3568       +4     
==========================================
+ Hits         2540     2556      +16     
+ Misses       1024     1012      -12     
Files with missing lines Coverage Δ
lib/Interpreter/CppInterOp.cpp 81.25% <100.00%> (+0.67%) ⬆️

... and 1 file with indirect coverage changes

Files with missing lines Coverage Δ
lib/Interpreter/CppInterOp.cpp 81.25% <100.00%> (+0.67%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably @aaronj0 should take a look.

@Vipul-Cariappa Vipul-Cariappa force-pushed the dev/func-callback-codegen branch from 3dcb1c8 to 2b096c7 Compare February 16, 2025 13:27
Copy link
Collaborator

@aaronj0 aaronj0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Vipul-Cariappa Vipul-Cariappa merged commit 9c818c5 into compiler-research:main Feb 18, 2025
73 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the dev/func-callback-codegen branch February 18, 2025 13:36
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Feb 21, 2025
`test01_instance_data_read_access` fixed by compiler-research/cppyy-backend#128 (enum changes)
others fixed by compiler-research/CPyCppyy#82 & compiler-research/CppInterOp#502
Vipul-Cariappa added a commit to compiler-research/cppyy that referenced this pull request Feb 22, 2025
`test01_instance_data_read_access` fixed by compiler-research/cppyy-backend#128 (enum changes)
others fixed by compiler-research/CPyCppyy#82 & compiler-research/CppInterOp#502
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants