This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING^3] Wconversion: fixes for C++ front-end


On 08 Feb 2007 05:55:35 -0600, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote:
"Manuel López-Ibáñez" <lopezibanez@gmail.com> writes:

| I am not so sure that I want to have ocp_convert to warn if necessary.
| In the same way as the C front-end has both convert_and_check and
| convert, and the former is used in just a few places, I don't think
| that invoking the warnings for every call to ocp_convert can actually
| work.

You're not going to warn for every call to ocp_convert.  ocp_convert
will warn only if necessary.  Please have another look at the
ocp_convert definition.  You cannot simply use convert_and_check,
because that function does not cover C++ conversions -- which is why
cp_convert existed.

Thanks to your previous explanation I understand that I cannot simply use convert_and_check. I am thinking on how to implement your proposal. However, I don't know when the caller wants ocp_convert to warn or not. The caller could pass a flag, but then every invokation of ocp_convert (and cp_convert and convert and probably something else) would need to be modified.

You should abandon the idea of calling it twice for the same
conversion.

OK. It is abandoned already. I was not suggesting that any more. I cannot understand why you think I was.

So, either you merge cp_convert and convert -- which is even riskier
as you say you're not familiar with the conversion functions, and this
area has proven fertile of bugs.  Or, you go directly to the function
which both convert and cp_convert call to do the real work.

I went there. I read the function and look for the places to do a call to a hypothetical function that gives the warnings. Assuming that is implemented somehow and there is a mechanism to know when the caller wants to get warnings, what should I do now with convert_and_check? It will call convert, which in turn calls ocp_convert which in turn needs to know that warnings are not needed since convert_and_check is going to handle that. However, convert_and_check also calls the C front-end version of convert. And I think we don't want to modify the C front-end's convert just to add a flag to signal ocp_convert that we don't want warnings.

| I would like to implement this in the best possible way but I don't
| see how can I solve the problems described above. Do you have any
| suggestions?

ones that you will not summarily dismiss?

Gabriel, please. I am not dismissing anything, I considered your suggestions and I started to think how to implement them and I made a list of potential problems. Then I asked you if you have any suggestions on how to solve them. Where is the dismissal? Where is the summarily part? I honestly think that you are always reading my messages in the wrong tone. You should read them with the tone of someone that is truly confused and trying to work with something that is new and without any pretentious, sarcastic or ironic ring.

Manuel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]