[Replicant] [PATCH 3/6] Silence warnings about unused parameters

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Wed Jun 19 12:40:00 UTC 2019


On Sun, 2 Jun 2019 19:58:26 +0300
Joonas Kylmälä <joonas.kylmala at iki.fi> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20190619/bfbc09e9/attachment.asc>


More information about the Replicant mailing list