diff mbox series

[v2,1/3] softmmu: Do not use C99 // comments

Message ID edcc3e56-2419-8645-8639-d9e50d710a1d@huawei.com
State New
Headers show
Series [v2,1/3] softmmu: Do not use C99 // comments | expand

Commit Message

chaihaoyu Nov. 3, 2020, 4:06 a.m. UTC
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(-)

--

Comments

Markus Armbruster Nov. 3, 2020, 6:24 a.m. UTC | #1
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
chaihaoyu Nov. 4, 2020, 7:49 a.m. UTC | #2
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
> 
> .
>
diff mbox series

Patch

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.