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

restype missing for all llvm APIs that return void #1088

Open
yashssh opened this issue Oct 14, 2024 · 1 comment
Open

restype missing for all llvm APIs that return void #1088

yashssh opened this issue Oct 14, 2024 · 1 comment
Labels
feature_request Feature Request

Comments

@yashssh
Copy link
Contributor

yashssh commented Oct 14, 2024

Although this haven't caused any problems until now, it might lead to hidden hard to debug failures in the future. Few examples from the codebase that need fixing.

  • LLVMPY_PrintValueToString, LLVMPY_SetValueName, LLVMPY_SetLinkage, etc from ffi/value.cpp
  • LLVMPY_GetHostCPUName, LLVMPY_GetDefaultTargetTriple, etc from ffi/targets.cpp
  • Similarly many from passmanagers.cpp, newpassmanagers.cpp, transfroms.cpp

It seems like it's a practice in the codebase to not declare restype for llvm functions returning void.

If this is to be fixed a question I have is what should be the restype for these functions, None or c_int?

@sklam
Copy link
Member

sklam commented Oct 15, 2024

For short term fixing the issue, the best practice is to set restype to None for void returning function.

For long term avoiding the issue, it was suggested in today's numba triage meeting to add a API like how ctypes.CFUNCTYPE(restype, *argtypes) would forces one to insert a restype.

@stuartarchibald stuartarchibald added the feature_request Feature Request label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature_request Feature Request
Projects
None yet
Development

No branches or pull requests

3 participants