Skip to contentSkip to conversation

parsing_hacks: Add bool to list of known typedefs

PATCH In review Jaskaran Singh 2 participants 6 messages Jan 19, 2020 – Jan 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parsing_hacks: Add bool to list of known typedefs

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -1
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
       | "acpi_handle"
Signature · 6 lines
2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw
Quoted 7 lines · Jaskaran Singh

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Quoted 7 lines

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

Why did nb passed increase? These are tokens that will not be able to be transformed by a semantic patch.

julia

Quoted 23 lines

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -2
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
       | "acpi_handle"
--
Quoted 3 lines

2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
Quoted 14 lines · Julia Lawall
Quoted 11 lines · Jaskaran Singh

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

Quoted 8 lines
Quoted 3 lines

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

Why did nb passed increase? These are tokens that will not be able to be
transformed by a semantic patch.

I suspect it's instances of nokprobe_inline in linux/kernel/trace/trace_kprobe.c. They're marked as CppMacro.

Here's results from my diff:

20402,20406c20288,20294
< passed:bool
< passed:bool
< passed:bool
< passed:bool
< passed:bool
---

Quoted 7 lines

passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline

20407a20296,20297

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20408a20299,20300

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20409a20302,20303

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20410a20305,20306

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

Cheers,
Jaskaran.

Quoted 23 lines

julia

Quoted 21 lines

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -1
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
Quoted 5 lines
Quoted 5 lines
parsing_c/parsing_hacks.ml +0 -1
       | "acpi_handle"
--

2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw
Quoted 19 lines · Jaskaran Singh
Quoted 18 lines · Julia Lawall
Quoted 14 lines · Jaskaran Singh

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

Quoted 7 lines
Quoted 4 lines

Why did nb passed increase? These are tokens that will not be able to be
transformed by a semantic patch.

I suspect it's instances of nokprobe_inline in linux/kernel/trace/trace_kprobe.c. They're marked as CppMacro.

OK, that looks ok. Could you update the log messages with that information?

thanks,
julia

Quoted 56 lines

Here's results from my diff:

20402,20406c20288,20294
< passed:bool
< passed:bool
< passed:bool
< passed:bool
< passed:bool
---

Quoted 7 lines

passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline
passed:nokprobe_inline

20407a20296,20297

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20408a20299,20300

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20409a20302,20303

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

20410a20305,20306

Quoted 2 lines

passed:nokprobe_inline
passed:nokprobe_inline

Cheers,
Jaskaran.

Quoted 23 lines

julia

Quoted 21 lines

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -1
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
parsing_c/parsing_hacks.ml +0 -1
       | "acpi_handle"
--

2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#4 lore raw
In reply to Jaskaran Singh
Quoted 4 lines · Jaskaran Singh

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Add bool to the list of known typedefs.

As far as I can see, this function is only used for avoiding to print some warning messages. So I'm not sure why it would have any impact on the parsing at all?

julia

Quoted 32 lines

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -2
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
       | "acpi_handle"
--
Quoted 3 lines

2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#5 lore raw
Quoted 6 lines · Julia Lawall
Quoted 3 lines · Jaskaran Singh

bool is widely used in the Linux kernel. Certain cases of parsing_hacks.ml would mislabel bool.

Quoted 8 lines
Quoted 1 line

Add bool to the list of known typedefs.

As far as I can see, this function is only used for avoiding to print some
warning messages. So I'm not sure why it would have any impact on the
parsing at all?

Sorry, It should've been clear in the patch.

This patch will only make any difference if it's applied on top of
https://www.mail-archive.com/[email protected]/msg06706.html

Cheers,
Jaskaran.

Quoted 33 lines

julia

Quoted 31 lines

Stats of --parse-c on Linux v5.5-rc4 are as follows:

Before:

nb good = 18956150, nb passed = 134062 =========> 0.70% passed

After:

nb good = 18956150, nb passed = 134073 =========> 0.70% passed

---
The above diff has been obtained after applying
https://www.mail-archive.com/[email protected]/msg06706.html

 parsing_c/parsing_hacks.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
parsing_c/parsing_hacks.ml +1 -1
index 685a4908..5e3301a0 100644
@@ -61,7 +61,7 @@ let is_known_typdef =
       | "u_char"   | "u_short"  | "u_int"  | "u_long"
       | "u8" | "u16" | "u32" | "u64"
       | "s8"  | "s16" | "s32" | "s64"
-      | "__u8" | "__u16" | "__u32"  | "__u64"
+      | "__u8" | "__u16" | "__u32"  | "__u64" | "bool"
         -> true
 
Quoted 5 lines
Quoted 5 lines
parsing_c/parsing_hacks.ml +0 -1
       | "acpi_handle"
--

2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees