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

Re: [RFC PATCH 1/5] [WIP]misra: add entries to the excluded list


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 31 Jul 2023 16:05:49 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MhiZfmuZN2Uh2vTgT7CdSDeJOhrDDBKo2iB2Z/zXyiY=; b=Ie2H8FVg+jcuDVZ4qrkxGwId9c8UqVkUg+EXvOJ5PeaZJdFJTLKIBdMmcZVwMdTGyVM8JqC6vuLuHp3rBoTPp1MiRMgHSk5aNW9fdSq9cH6SYkczwyKJpao4ucCY+yjkQrQ+SIwBC8GOkHPVPQ3RacH4bfk5Z2QMJIuSo1LaU3v0CRDuVpMVLUYuUYP7lbK2U7GImur/31qHE2VDthofhunDqTRVkt4hxujugOE0YHIR4DLgoT6fNfewo90SS4coZ9emZan1zeInWmSu7NSUQsRjtxFBihltHu0xs5aIp8LCF9sd7zzk2fZALb9a4XaGXhgfQGLePscYD95QtYkatw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WlRZPhJV2vLue+pD+JSEsrHYxAMXab4oWlAw1n9SJiLNcEkX+ryPDgG0kcqxLBlMDMYd1+jsbAeKLJ4iauUTsYq5KCXYHI8u9dtOtEKGYID2fa104IaoCuDwzWUT2eW5Z3dJPnszH4w6SbaEMqPMJhxVunm30nvfA/cNAaSg4qReKK0n2s0GYfTEXRp9cSBp7OqvkLqz5ZroBK0w7faOyXRP0foctVHpBdeYli6wqUcq/Sq3976LCSRaFY35s6J90nf5w4vvPS7hsS5gkt6cVUKJnkV2ONPNajFw7Z1A2HrKdszEpCz/eVTs2B8wW9+SjqIKyYUi/lDvC46q1R0mRg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 31 Jul 2023 16:07:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZwSs9042EQJWI+kCE6wP5BUPzKq/T/JsAgAADsACAAAJogIAADKcA
  • Thread-topic: [RFC PATCH 1/5] [WIP]misra: add entries to the excluded list


> On 31 Jul 2023, at 16:20, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 31.07.2023 17:11, Luca Fancellu wrote:
>>>> +        {
>>>> +            "rel_path": "arch/x86/include/asm/bug.h",
>>>> +            "comment": "Includes mostly assembly macro"
>>>> +        },
>>> 
>>> Mind me asking why assembly macros wouldn't want maintaining in proper
>>> style?
>> 
>> From what I know (experts on CF correct me if I am wrong) clang-format is 
>> meant to format only some languages
>> (C/C++/...) and assembly is not one of them, so what is happening is that 
>> most of the time clang-format breaks
>> it, in fact we are formatting only .c and .h, but since we have some headers 
>> with assembly macros, I’ve seen some issues
>> that ranges from really ugly formatting to build break.
>> 
>> One thing we could do, is to export the headers that contain only assembly 
>> stuffs in dedicate headers (<header>_asm.h ?)
>> so that we could easily use a name regex to exclude "*_asm.h” from 
>> clang-format? And also these headers could #error if
>> included when __ASSEMBLY__ is not defined?
> 
> In principle this may be a route to go (naming aside), but first of all
> I wonder what "assembler macros" are to you: We use both C macros and
> true assembler macros in assembly code. The former I would hope formatting
> tools don't have an issue with.

Yes, C macros are clearly not an issue, true assembler macros are, like the 
example below:

    .macro BUG_FRAME type, line, file_str, second_frame, msg

    .if \type >= BUGFRAME_NR
        .error "Invalid BUGFRAME index"
    .endif

    .L\@ud: ud2a

    .pushsection .rodata.str1, "aMS", @progbits, 1
         .L\@s1: .asciz "\file_str"
    .popsection

    .pushsection .bug_frames.\type, "a", @progbits
        .p2align 2
        .L\@bf:
        .long (.L\@ud - .L\@bf) + \
               ((\line >> BUG_LINE_LO_WIDTH) << BUG_DISP_WIDTH)
        .long (.L\@s1 - .L\@bf) + \
               ((\line & ((1 << BUG_LINE_LO_WIDTH) - 1)) << BUG_DISP_WIDTH)

        .if \second_frame
            .pushsection .rodata.str1, "aMS", @progbits, 1
                .L\@s2: .asciz "\msg"
            .popsection
            .long 0, (.L\@s2 - .L\@bf)
        .endif
    .popsection
    .endm

I don’t think CF has knowledge of the token .macro/.endm/.if/[...] and so it 
formats them
in weird ways

> 
> Jan


 


Rackspace

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