[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/3] softmmu: Do not use C99 // comments
From: |
chaihaoyu |
Subject: |
Re: [PATCH v2 1/3] softmmu: Do not use C99 // comments |
Date: |
Wed, 4 Nov 2020 15:49:38 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
Thank you for your replay. That's OK if C99 support both kinds of comment style.
————————————————————————————————————————————————
> chaihaoyu <chaihaoyu1@huawei.com> writes:
>
>> Hi, recently I found some code style problems while using checkpatch.pl
>> tool,please review.
>>
>> Date: Tue, 3 Nov 2020 11:01:40 +0800
>> signed-off-by: Haoyu Chai<chaihaoyu1@huawei.com>
>> ---
>> softmmu/memory.c | 2 +-
>> softmmu/memory_mapping.c | 2 +-
>> softmmu/physmem.c | 2 +-
>> 3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/softmmu/memory.c b/softmmu/memory.c
>> index 107ce0a4f8..5fb591b001 100644
>> --- a/softmmu/memory.c
>> +++ b/softmmu/memory.c
>> @@ -36,7 +36,7 @@
>> #include "hw/boards.h"
>> #include "migration/vmstate.h"
>>
>> -//#define DEBUG_UNASSIGNED
>> +/* #define DEBUG_UNASSIGNED */
>>
>> static unsigned memory_region_transaction_depth;
>> static bool memory_region_update_pending;
>> diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c
>> index 18d0b8067c..f64053499e 100644
>> --- a/softmmu/memory_mapping.c
>> +++ b/softmmu/memory_mapping.c
>> @@ -19,7 +19,7 @@
>> #include "exec/memory.h"
>> #include "exec/address-spaces.h"
>>
>> -//#define DEBUG_GUEST_PHYS_REGION_ADD
>> +/* #define DEBUG_GUEST_PHYS_REGION_ADD */
>>
>> static void memory_mapping_list_add_mapping_sorted(MemoryMappingList *list,
>> MemoryMapping *mapping)
>> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
>> index 44ffb60b5d..78c1b6580a 100644
>> --- a/softmmu/physmem.c
>> +++ b/softmmu/physmem.c
>> @@ -75,7 +75,7 @@
>> #include <daxctl/libdaxctl.h>
>> #endif
>>
>> -//#define DEBUG_SUBPAGE
>> +/* #define DEBUG_SUBPAGE */
>>
>> /* ram_list is read under rcu_read_lock()/rcu_read_unlock(). Writes
>> * are protected by the ramlist lock.
>
> I recommend to leave these alone.
>
> CODING_STYLE.rst:
>
> Rationale: The // form is valid in C99, so this is purely a matter of
> consistency of style. The checkpatch script will warn you about this.
>
> For "real" comments, we overwhelmingly use /* */, and avoiding // makes
> sense. Most exceptions are in code we copy from elsewhere, such as
> disas/libvixl/.
>
> For commenting out *code*, we use both forms. Here are the counts for
> commenting out macro definitions:
>
> $ git-grep '^/\* *# *define' | wc -l
> 125
> $ git-grep '^// *# *define' | wc -l
> 192
>
> .
>