-
Notifications
You must be signed in to change notification settings - Fork 356
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
Check fixed args number for variadic function #4122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash
@rustbot author |
This comment has been minimized.
This comment has been minimized.
So now there is this weird function definition in this PR fn open(
&mut self,
args: &[OpTy<'tcx>],
fixed: &[OpTy<'tcx>; 2],
_var: &[OpTy<'tcx>],
) -> InterpResult<'tcx, Scalar> { where Since we already split fixed and var args through
It will lead to diagnostic like this: 11 | let _fd = unsafe { libc::open(name_ptr, libc::O_CREAT) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of arguments for `open(pathname, O_CREAT, ...)`: got 0, expected at least 1 Or maybe we can just ignore the fixed args and var args returned by |
I would suggest to rename |
I didn't manage completely replace Lines 32 to 42 in c2a3761
I think as a miri specific extern function, the argument here shouldn't be classified as a vararg? |
@rustbot ready |
Oh dang. We have a comment in the docs for this function saying "The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments on the first place where you used the new infra; they apply everywhere in the PR.
@rustbot author |
Alright, I can send a follow-up PR after this landed. |
@rustbot ready |
@rustbot author |
@rustbot ready |
Please also squash the PR into a single commit. |
@rustbot author |
Ooh I accidentally push to github, squash then push, so the change is not visible from What have changed:
@rustbot ready |
Looks good :) |
This PR added
check_shim_variadic
to be used by variadic function shimscheck_min_vararg_count
to retrieve varargs array from slicecheck_fixed_args_count
to check if we got expected number of fixed argscc #4013