Skip to contentSkip to conversation

coding style question - c99 comments

dpdk-dev Applied Lance Richardson 4 participants 7 messages Jan 23, 2020 – Feb 22, 2020

lore
Share & tools
lore
#0 lore raw

The DPDK Coding Style document doesn't mention the use of c99 comments using '//' as a comment delimiter, but it does say that traditional '/* */' comment
delimiters should be used and therefore seems to imply that c99-style comments are not allowed.

Is this correct?

Lance

#1 lore raw
Quoted 9 lines · On Thu, 23 Jan 2020 11:05:58 -0500 Lance Richardson…

The DPDK Coding Style document doesn't mention the use of c99 comments using '//' as a comment delimiter, but it does say that traditional '/* */' comment
delimiters should be used and therefore seems to imply that c99-style comments are not allowed.

Is this correct?

Lance

Don't use c99 comments.
These will get flagged by checkpatch

#2 lore raw
Quoted 10 lines · Stephen Hemminger
Quoted 6 lines · On Thu, 23 Jan 2020 11:05:58 -0500 Lance Richardson…

The DPDK Coding Style document doesn't mention the use of c99 comments using '//' as a comment delimiter, but it does say that traditional '/* */' comment
delimiters should be used and therefore seems to imply that c99-style comments are not allowed.

Quoted 6 lines
Quoted 3 lines

Is this correct?

Lance

Don't use c99 comments.
These will get flagged by checkpatch

Hi Stephen,

Actually, the reason I was asking was they aren't being flagged by checkpatch.

It seems checkpatch.pl now has this:
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE

If c99 comments are should not be allowed, it looks like C99_COMMENT_TOLERANCE should
be added to the list of checkers to ignore in checkpatches.sh. I was thinking of rolling a patch,
but wanted to first confirm that they are actually not allowed.

Thanks,

Lance

#3 lore raw
Quoted 27 lines · Lance Richardson
Quoted 10 lines · Stephen Hemminger
Quoted 6 lines · On Thu, 23 Jan 2020 11:05:58 -0500 Lance Richardson…

The DPDK Coding Style document doesn't mention the use of c99 comments using '//' as a comment delimiter, but it does say that traditional '/* */' comment
delimiters should be used and therefore seems to imply that c99-style comments are not allowed.

Quoted 6 lines
Quoted 3 lines

Is this correct?

Lance

Don't use c99 comments.
These will get flagged by checkpatch

Hi Stephen,

Actually, the reason I was asking was they aren't being flagged by checkpatch.

It seems checkpatch.pl now has this:
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE

Quoted 6 lines

If c99 comments are should not be allowed, it looks like C99_COMMENT_TOLERANCE should
be added to the list of checkers to ignore in checkpatches.sh. I was thinking of rolling a patch,
but wanted to first confirm that they are actually not allowed.

Hi Lance,

That is what I understand from coding style document that c99 comments are not allowed and agree to not use them.

+1 to add C99_COMMENT_TOLERANCE

#4 lore raw

Thanks, a patch adding C99_COMMENT_TOLERANCE has been posted.

Lance

Quoted 46 lines · Ferruh Yigit
Quoted 10 lines · Lance Richardson
Quoted 8 lines · Stephen Hemminger
Quoted 4 lines · On Thu, 23 Jan 2020 11:05:58 -0500 Lance Richardson…

The DPDK Coding Style document doesn't mention the use of c99 comments using '//' as a comment delimiter, but it does say that traditional '/* */' comment
delimiters should be used and therefore seems to imply that c99-style

comments

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

are not allowed.

Is this correct?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Lance

Don't use c99 comments.
These will get flagged by checkpatch

Hi Stephen,

Actually, the reason I was asking was they aren't being flagged by

checkpatch.

Quoted 11 lines

It seems checkpatch.pl now has this:
my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE

If c99 comments are should not be allowed, it looks like C99_COMMENT_TOLERANCE should
be added to the list of checkers to ignore in checkpatches.sh. I was thinking of rolling a patch,
but wanted to first confirm that they are actually not allowed.

Hi Lance,

That is what I understand from coding style document that c99 comments are not
allowed and agree to not use them.

+1 to add C99_COMMENT_TOLERANCE

#5 lore raw

PATCH v2 1/1 devtools: check c99 comment use in checkpatches.sh

In reply to Ferruh Yigit

C99-style comments are not permitted according to DPDK coding style guidelines, enable checking for these by checkpatch.pl.

---
v2:
* Fixed a typo in commit message.

 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +1 -1
index b16bace92..c996a8780 100755
@@ -33,7 +33,7 @@ VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LONG_LINE_STRING,\
 LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,C99_COMMENT_TOLERANCE"
 options="$options $DPDK_CHECKPATCH_OPTIONS"
 
 print_usage () {
Signature · 1 line
2.17.1
#6 lore raw

Re: [dpdk-dev] [PATCH v2] devtools: check c99 comment use in checkpatches.sh

15/02/2020 18:09, Lance Richardson:

Quoted 4 lines

C99-style comments are not permitted according to DPDK coding style guidelines, enable checking for these by checkpatch.pl.

Applied, thanks