[PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.

Alejandro Vallejo posted 15 patches 4 months, 2 weeks ago
Only 14 patches received!
There is a newer version of this series
[PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Alejandro Vallejo 4 months, 2 weeks ago
There's the unwritten convention in x86 of splitting type names using
underscores. Add such convention to the CODINNG_STYLE to make it
common and less unwritten.

Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
---
 CODING_STYLE | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 5644f1697f..e91ef7b3ca 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -126,6 +126,9 @@ register).
 Especially with pointer types, whenever the pointed to object is not
 (supposed to be) modified, qualify the pointed to type with "const".
 
+When defining types, split its words using underscores (e.g: prefer my_foo to
+myfoo).
+
 Comments
 --------
 
-- 
2.43.0
Re: [PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Jan Beulich 4 months, 2 weeks ago
On 13.06.2025 17:13, Alejandro Vallejo wrote:
> There's the unwritten convention in x86 of splitting type names using
> underscores. Add such convention to the CODINNG_STYLE to make it
> common and less unwritten.
> 
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
> ---
>  CODING_STYLE | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/CODING_STYLE b/CODING_STYLE
> index 5644f1697f..e91ef7b3ca 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -126,6 +126,9 @@ register).
>  Especially with pointer types, whenever the pointed to object is not
>  (supposed to be) modified, qualify the pointed to type with "const".
>  
> +When defining types, split its words using underscores (e.g: prefer my_foo to
> +myfoo).

Why's this being put in the Types section? This is about identifiers, and
ought to not be limited to the names of types.

Jan
Re: [PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Alejandro Vallejo 4 months, 2 weeks ago
On Mon Jun 16, 2025 at 8:48 AM CEST, Jan Beulich wrote:
> On 13.06.2025 17:13, Alejandro Vallejo wrote:
>> There's the unwritten convention in x86 of splitting type names using
>> underscores. Add such convention to the CODINNG_STYLE to make it
>> common and less unwritten.
>> 
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>>  CODING_STYLE | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/CODING_STYLE b/CODING_STYLE
>> index 5644f1697f..e91ef7b3ca 100644
>> --- a/CODING_STYLE
>> +++ b/CODING_STYLE
>> @@ -126,6 +126,9 @@ register).
>>  Especially with pointer types, whenever the pointed to object is not
>>  (supposed to be) modified, qualify the pointed to type with "const".
>>  
>> +When defining types, split its words using underscores (e.g: prefer my_foo to
>> +myfoo).
>
> Why's this being put in the Types section? This is about identifiers, and
> ought to not be limited to the names of types.
>
> Jan

Because the existing argument had to do with type names and I wanted to limit
the blast radius of the new rules on architectures that don't currently follow
them. I don't care where it sits or how large its scope is. If others are
equally happy to generalise to any identifier, I'm happy to do so.

Cheers,
Alejandro
Re: [PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Stefano Stabellini 4 months, 2 weeks ago
On Fri, 13 Jun 2025, Alejandro Vallejo wrote:
> There's the unwritten convention in x86 of splitting type names using
> underscores. Add such convention to the CODINNG_STYLE to make it
                                          ^ CODING_STYLE

> common and less unwritten.
> 
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
> ---
>  CODING_STYLE | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/CODING_STYLE b/CODING_STYLE
> index 5644f1697f..e91ef7b3ca 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -126,6 +126,9 @@ register).
>  Especially with pointer types, whenever the pointed to object is not
>  (supposed to be) modified, qualify the pointed to type with "const".
>  
> +When defining types, split its words using underscores (e.g: prefer my_foo to
> +myfoo).

Minor NIT:
When defining types, separate words using underscores (for example, use
"my_foo" instead of "myfoo").


Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


>  Comments
>  --------
>  
> -- 
> 2.43.0
>
Re: [PATCH v3 03/14] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Alejandro Vallejo 4 months, 2 weeks ago
On Sat Jun 14, 2025 at 2:32 AM CEST, Stefano Stabellini wrote:
> On Fri, 13 Jun 2025, Alejandro Vallejo wrote:
>> There's the unwritten convention in x86 of splitting type names using
>> underscores. Add such convention to the CODINNG_STYLE to make it
>                                           ^ CODING_STYLE
>
>> common and less unwritten.
>> 
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>>  CODING_STYLE | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/CODING_STYLE b/CODING_STYLE
>> index 5644f1697f..e91ef7b3ca 100644
>> --- a/CODING_STYLE
>> +++ b/CODING_STYLE
>> @@ -126,6 +126,9 @@ register).
>>  Especially with pointer types, whenever the pointed to object is not
>>  (supposed to be) modified, qualify the pointed to type with "const".
>>  
>> +When defining types, split its words using underscores (e.g: prefer my_foo to
>> +myfoo).
>
> Minor NIT:
> When defining types, separate words using underscores (for example, use
> "my_foo" instead of "myfoo").

Fine by me. That's clearer.

>
>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Thanks!

>
>
>>  Comments
>>  --------
>>  
>> -- 
>> 2.43.0
>> 

Cheers,
Alejandro