Hello jiang,

Under the assumption that you would like to improve your English skills,
I'll try to revise what you wrote to what I think you meant. My changes are
in *bold*. :-)

"Hello everyone! I want to add uninitialized variable warning*s to tcc*. *Do
y*ou have any good ideas*?* *Please let me know if this *would not be too
simple to *do. That is, would this be overly complicated to implement?*"
(I'm really not certain about your intention with the last sentence.)

I think it is a very good thing that you brought this up on the list before
implementing it. I see tcc as a fast, C99-compliant compiler. It tries to
help where it can, but it does not focus on being nice. If you are not
posing something that brings it closer to compliance, improving the speed,
or pushing a new architecture, I think the tcc community may be
uninterested. I for my part have a very slight preference towards not
including the warning.

Tracking whether a variable has been initialized or not will require adding
an entry to the Sym struct somewhere, or co-opting some unused bit in one
of the fields. You might be able to hack that into one of the bits of the
associated number, but I am a bit fuzzy on how that's used for identifiers.
Somebody else on the list might be able to say more about how those are
used. If you can't fit it into the associated number, then you would have
to add a field to the Sym struct, increasing the working memory footprint
of the compiler. It would also require adding checks to that bit for any
r-value operation. I don't know exactly how those are parsed. If you're
lucky, it's only one place, but if you're unlucky, it'll be all over the
place. In other words, it may be easy, or it may be difficult.

However, this will only impose a speed penalty on the compiler, it will not
make it any faster. If you decide to try to implement it, you must write
benchmarks showing how much slower tcc will run for some important
compilation targets. Take a large project, such as Awk, and see how much
slower it takes to compile with these warnings implemented. See how much
more memory it will consume. If the numbers involve a negligible change,
you might get buy-in. (Note: negligible is in the eye of the beholder. A 1%
slow-down may be too much.)

Please correct me if I mis-interpreted your question, and I hope my opinion
on the matter helps.
David


On Thu, Jun 5, 2014 at 12:42 AM, jiang <[email protected]> wrote:

> Hello everyone! I want to add tcc uninitialized variable warning. You have
> any good ideas. If I would not be too simple to say here.
>
> jiang
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>



-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to