On Sun, 2 Jun 2019 19:58:26 +0300 Joonas Kylmälä <[email protected]> wrote:
> Why is the env variable here not marked unused meanwhile the two > others are? The compiler warns about unused variable which makes libsamsung-ril fails to build on Android 9. So I had the choice between improving the code by fixing the compiler warnings, and finding the place in the Android build system where the compiler does -Werror. I chose the former. Here this tells the compiler that I'm perfectly aware that both parameters are not used in the code of the function. Here env is used below so it cannot be marked as unused: > if (env == NULL) > return NULL; [...] > ril_data->env = env; And removing the unused parameters is not possible in that particular case because that RIL_Init is part of the API between the RIL and the libril implementation: The RIL dlopens the libril implementation and then calls that function. From rild.c in Replicant 6: > rilInit = (const RIL_RadioFunctions *(*)(const struct RIL_Env *, int, > char **)) dlsym(dlHandle, "RIL_Init"); [...] > funcs = rilInit(&s_rilEnv, argc, rilArgv); As for the internal functions, I think it's better to keep consistent parameters in the functions as it makes the code more simple to understand. Denis.
pgp2m943dHETT.pgp
Description: OpenPGP digital signature
_______________________________________________ Replicant mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/replicant
