Re: [Vala] unused variable warning in generated C code




Date: Fri, 12 Dec 2014 10:54:53 +0100
From: Luca Bruno <lethalman88 gmail com>

On 12/12/2014 10:46, Nicolas CARRIER wrote:
Hello,
When I compile the following code :

public static int main(string[] args) {
     int[] b = { 2, 4, 6, 8 };
     foreach (int a in b)
         stdout.printf("%d\n", a);
     return 0;
}

with :

$ valac -C main.vala
$ gcc -Wunused-variable main.c -o main $(pkg-config --cflags --libs
glib-2.0)


I get the following warning :
main.c: In function ?_vala_main?:
main.c:38:8: attention : unused variable ?_a_collection_size_?
[-Wunused-variable]
    gint _a_collection_size_ = 0;
         ^
What is the reason for this warning ?
Valac not clever enough to delete unused C variables.

Is it possible to get rid of it ?
Yes, ignore C warnings. Or fix vala, in this case it's not easy so I
don't suggest doing it :)


Thank you for your answer.
The problem is that when I compile vala code with the warning compilations flags our build system enables, I have a lot of warnings. This one is only one amongst others.
The risk is high to miss a real one in the mass...

Is it planned to "cleanup" this aspect of the generated C code ?

It would be interesting to dig into the code myself, but for now, I am not sufficiently skilled in vala, so it would take too much time I think.


Concerning the other warnings I have, do you think it's worth it to submit them to the mailing list ? Or will the answers be of the same kind ?

Thank you.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]