Renaming var causes curly bracket to be inserted

Simon Walter simon at explicit.technology
Thu May 28 19:40:35 BST 2020


On 5/27/20 4:39 PM, Milian Wolff wrote:
> On Freitag, 22. Mai 2020 04:24:34 CEST Simon Walter wrote:
>> Hi all,
>>
>> First time posting to this list.
>>
>> static void kdevelop_var_rename_bug(void)
>> {
>>     //It doesn't have this problem on my laptop which has the exact
>>     //same version and exact same OS version.
>>     char * * Row = NULL; //right click on "Row" and choose "Rename..."
>>     if (false) abort(); //an extra curly brace will appear on the next line
>>     Row = NULL;
>>
>>     //It only happens when Row is right after an if that is not
>> contained in one
>>     //line
>>     if (false)
>>     {abort();}
>>     Row = NULL;
>>
>>     if (false) {abort();}//This causes the bug too.
>>     Row = NULL;
>>
>>     //Not if there no comment on the same line though!
>>     if (false) {abort();}
>>     Row = NULL;
>>
>>     //This triggers the problem too.
>>     if (false) abort();
>>     Row = NULL;
>> }
>>
>> In the above comment I mention another computer with the same version
>> that does not have this problem. The version is 5.0.3. I have downloaded
>> the 5.5.1 Appimage and tried that, and it still has this odd and painful
>> behavior.
>>
>> ...
> What code formatter do you have configured? Do you have astyle/uncrustify/
> clang-format or something like that?
>
> Otherwise can you create a standalone file (the above probably is missing some 
> header includes), such that we can investigate that on our side too?
>
> Thanks
>
Hello Mr. Wolff,

My apologize for the late reply.

I wasn't aware there was an external formatter involved for renaming. I
found the formatter location in the settings dialog, and it's on
Artistic Style. I don't have astyle installed - nor indent, but I did on
my laptop. So I removed them and a similar behavior occurred. Does that
it make it a clang bug? uncrustify looks interesting. I will try the
Custom Script Formatter. If I understand correctly, kdev_format_source
allows me to have per project formatting? Where do I place the
format_sources file?

Thank you for your help.

Attached is a c program that triggers this behavior.

If it's not reproducible on your side, is there any way I can help with
some debugging info?

Best regards,

Simon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: var_rename.c
Type: text/x-csrc
Size: 1882 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20200529/7d97b292/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20200529/7d97b292/attachment.sig>


More information about the KDevelop mailing list