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

Re: [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting


  • To: Viktor Mitin <viktor.mitin.19@xxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Fri, 2 Aug 2019 12:57:19 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3zNb9HE89o+wf8yVAvDgpeMxFbRxax3A6LTWO9OjcYc=; b=l+xEJ5Sw9asXybGJBtmv8ko3cdq+x6ERofhePZpyLhwDA7ClEpIzcvz+oQLSRn1FcMu2fIVZYs3smB8QIFLJFczy737hrbjNHjI3zB8uK3brzKGvzK72NqSLEkANki5JghSsXh7ZIlAE0Z0H7TfscZ97lfBpUVDrCnqEdhVvuB+YCFXhUUOo/47aB0ZpBjEOed/LfqDltZr+sd4MOHUPkQGhoKFIEnQWVtZ1kFWeBnPUEZNX5MbmcBsBLoJ5PVQbv+itSXAPXVlpbt0gyx8aHacWtYMLwDcIE6hbQEH7JjU3mrZlQtGfsX+UoTDu/Wo0mnPVN+HL5+enfKnZ6nnGhA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V90Zg34zUg/GuHlVCJFHNFQ5k+z0/xByTZ6JB29/v69XREldWrYZz8pCg3ZmduU/zerULuQaRRUE3/gbz2GqlCY93D5AgOLOhuvuIF39e67F8+gzpHSEOZwT1ktAIvHaF9/XJzIgnQVVDwt+pukLyLfcAwL55U0GaA0mB2LwONlxVfDLgS6mhLyo6h/B0Nto3JYJ7kY+pBerP1W6Hsgh5YBJ78Jas6FV/Q1wGQQVp+AuGCdRwBl6SidaCCS3xBem03OzA1BjAJ1aqdMN49M4hUybngNHVMyJ9wN8QeFXv9HsodCjj1SslE9p2AHi7bNH0Ivz5przpySWxvFxrq7sAg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Juergen Gross <JGross@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, Iurii Artemenko <Iurii_Artemenko@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Lars Kurth <lars.kurth@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 02 Aug 2019 12:58:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVPXcqh/rpHqCfrE2r6qBBgy1Fu6bQeNoBgAADe8CAAAegOoAMhBoBgASM1gCAAAh2qIAAA3yAgANcJ+OAAQAfgIAATfBxgAAJclqAAUxDnIAADDCOgAAnnP+AABQgAA==
  • Thread-topic: [Xen-devel] [RFC] xen: Add .astylerc for automated style-formatting

On 02.08.2019 13:44, Viktor Mitin wrote:
> On Fri, Aug 2, 2019 at 12:23 PM Juergen Gross <jgross@xxxxxxxx> wrote:
> 
>>>> A snipplet from commit 57f8b13c724023c78fa15a80452d1de3e51a1418:
>>>>
>>>> @@ -4096,14 +4097,12 @@ retry_transaction:
>>>>             goto out;
>>>>
>>>>         if (target == NULL) {
>>>> -        libxl__xs_printf(gc, t, target_path, "%"PRIu32,
>>>> -                         (uint32_t) info.current_memkb);
>>>> -        *target_memkb = (uint32_t) info.current_memkb;
>>>> +        libxl__xs_printf(gc, t, target_path, "%"PRIu64,
>>>> info.current_memkb);
>>>> +        *target_memkb = info.current_memkb;
>>>>         }
>>>>         if (staticmax == NULL) {
>>>> -        libxl__xs_printf(gc, t, max_path, "%"PRIu32,
>>>> -                         (uint32_t) info.max_memkb);
>>>> -        *max_memkb = (uint32_t) info.max_memkb;
>>>> +        libxl__xs_printf(gc, t, max_path, "%"PRIu64, info.max_memkb);
>>>> +        *max_memkb = info.max_memkb;
>>>>         }
>>>>
>>>>         rc = 0;
>>>>
>>>
>>> I've build gnu diffutils latest release 3.7 and checked the code and
>>> the issue. It seems this feature (-p) doesn't work properly and has
>>> many more bugs than just the issue with labels. See the example below,
>>> the change has been made in the function a1(), however, in the diff
>>> another function is shown a().
>>
>> This case is completely fine, as the context of the diff is starting
>> before the definition of a() (and just after a1()). This is important in
>> case you only add a new function for example.
>>
> 
> Juergen, the diff returns wrong name of the function silently. I don't
> think it is 'completely fine', I would rather call it a bug, or
> non-documented limitation, but definitely not a feature. As I wrote
> previously, I played with -p a little and observed more similar issues
> with it. The reason is that the next diff code (see below) tries to
> match function names using simple regexp for a line, assuming that
> line with function name cannot start with a 'non-alpha' characters. So
> even adding one more space before a line with function name breaks it.

And there's not supposed to be any blank ahead of a function's
heading.

> diffutils-3.7/src/diff.c:462
>      case 'p':
>        show_c_function = true;
>        add_regexp (&function_regexp_list, "^[[:alpha:]$_]");
> 
> It is probably could be improved by adding 'no : symbol at the end of
> the line' logic to this regexp. It will resolve the issue with labels,
> but will add one more bug (or limitation) about using ":" in such
> lines.
> 
> The issue is more general here. The diff tool should not parse any
> programming languages, it should just compare the strings.

"The strings" being which ones? The limitations (if you want to call
them such) of "diff -p" are, I think, well understood. And there's
no "parsing" here at all - the regexp simply checks the first
character. The time when you wanted to make it skip labels would be
where it would become more like "parsing".

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.