-
Notifications
You must be signed in to change notification settings - Fork 84
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
utf_len declaration is incompatible with definition #11
Comments
michaelforney
added a commit
to michaelforney/less
that referenced
this issue
Jul 6, 2019
…otion In order for a prototype declaration and non-prototype function definition to be compatible, the promoted type of the non-prototype function parameters must be compatible with the type of the corresponding prototype parameter. Since funcs.h is autogenerated by mkfuncs.pl which copies the parameter types as-is, use the promoted type in the definitions so that the types are unaffected by default argument promotion. Fixes gwsw#11
gwsw
pushed a commit
that referenced
this issue
Jul 6, 2019
…otion (#14) In order for a prototype declaration and non-prototype function definition to be compatible, the promoted type of the non-prototype function parameters must be compatible with the type of the corresponding prototype parameter. Since funcs.h is autogenerated by mkfuncs.pl which copies the parameter types as-is, use the promoted type in the definitions so that the types are unaffected by default argument promotion. Fixes #11
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With
HAVE_ANSI_PROTOS
,utf_len
is declared infuncs.h
asand defined in
charset.c
asHowever, according to the C standard (C89 3.5.4.3, C99 6.7.5.3p15),
Since
int
can represent all the values ofunsigned char
,ch
gets promoted toint
by default argument promotions.unsigned char
is not compatible withint
, making the two function types incompatible.To fix this, the prototype declaration in
funcs.h
needs to be updated toint utf_len(int ch)
. However, since these declarations are autogenerated from the definitions, it is probably easier to resolve by just changing the type in the definition fromunsigned char
toint
.This same issue also affects
pappend
andset_status_col
inline.c
.The text was updated successfully, but these errors were encountered: