ParenType and FunctionType are types present in the C AST that
are not present in the SmPL AST. In the pursuit of aligning
both the C and SmPL ASTs, add these types to the SmPL ASTs.
For a function pointer as follows:
int (*x)(params)
The SmPL AST would be as follows:
ParenType -> Pointer -> FunctionType params -> BaseType int
For an array of function pointers as follows:
int (*x[2])(params)
The SmPL AST would be as follows:
ParenType -> Array 2 -> Pointer -> FunctionType params -> BaseType int
Signed-off-by: Jaskaran Singh
---
ocaml/coccilib.mli | 6 ++
parsing_cocci/ast0_cocci.ml | 3 +++
parsing_cocci/ast0_cocci.mli | 3 +++
parsing_cocci/ast_cocci.ml | 3 +++
parsing_cocci/ast_cocci.mli | 3 +++
5 files changed, 18 insertions(+)
diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli
index 5a913099..e5409a97 100644
--- a/ocaml/coccilib.mli
+++ b/ocaml/coccilib.mli
@@ -2709,6 +2709,9 @@ module Ast_cocci :
| Pointer of fullType * string mcode
| FunctionPointer of fullType * string mcode * string mcode *
string mcode * string mcode * parameter_list * string mcode
+ | ParenType of string mcode (* ( *) * fullType * string mcode (* ) *)
+ | FunctionType of fullType *
+ string mcode (* ( *) * parameter_list * string mcode (* ) *)
| Array of fullType * string mcode * expression option * string mcode
| Decimal of string mcode * string mcode * expression *
string mcode option * expression option * string mcode
@@ -3353,6 +3356,9 @@ module Ast0_cocci :
| Pointer of typeC * string mcode
| FunctionPointer of typeC * string mcode * string mcode *
string mcode * string mcode * parameter_list * string mcode
+ | ParenType of string mcode * typeC * string mcode
+ | FunctionType of typeC *
+ string mcode * parameter_list * string mcode
| Array of typeC * string mcode * expression option * string mcode
| Decimal of string mcode * string mcode * expression *
string mcode option * expression option * string mcode
diff --git a/parsing_cocci/ast0_cocci.ml b/parsing_cocci/ast0_cocci.ml
index 77dc46f0..0acbeaa4 100644
--- a/parsing_cocci/ast0_cocci.ml
+++ b/parsing_cocci/ast0_cocci.ml
@@ -203,6 +203,9 @@ and base_typeC =
| FunctionPointer of typeC *
string mcode(* ( *)*string mcode(* * *)*string mcode(* ) *)*
string mcode (* ( *)*parameter_list*string mcode(* ) *)
+ | ParenType of string mcode (* ( *) * typeC * string mcode (* ) *)
+ | FunctionTypeof typeC *
+ string mcode (* ( *) * parameter_list * string mcode (* ) *)
| Array of typeC * string mcode (* [ *) *
expression option * string mcode (* ] *)
| Decimal of string mcode (* decimal *) * string mcode (* ( *) *
diff --git a/parsing_cocci/ast0_cocci.mli b/parsing_cocci/ast0_cocci.mli
index 274c6bc2..33bd12b2 100644
--- a/parsing_cocci/ast0_cocci.mli
+++ b/parsing_cocci/ast0_cocci.mli
@@ -194,6 +194,9 @@ and base_typeC =
| FunctionPointer of typeC *
string mcode(* ( *)*string mcode(* * *)*string mcode(* ) *)*
string mcode (* ( *)*parameter_list*string mcode(* ) *)
+ | ParenType of string mcode (* ( *) * typeC * string mcode (* ) *)
+ | FunctionTypeof typeC *
+ string mcode (* ( *) * parameter_list * string mcode (* ) *)
| Array of typeC * string mcode (* [ *) *
expression option * string mcode (* ] *)
| Decimal of string mcode (* decimal *) * string mcode (* ( *) *
diff --git a/parsing_cocci/ast_cocci.ml b/parsing_cocci/ast_cocci.ml
index ba6ec29e..f8e6dee6 100644
--- a/parsing_cocci/ast_cocci.ml
+++ b/parsing_cocci/ast_cocci.ml
@@ -343,6 +343,9 @@ and base_typeC =
| FunctionPointer of fullType *
string mcode(* ( *)*string mcode(* * *)*string mcode(* ) *)*
string mcode (* ( *)*parameter_list*string mcode(* ) *)
+ | ParenType of string mcode (* ( *) * fullType * string mcode (* ) *)
+ | FunctionTypeof fullType *
+ string mcode (* ( *) * parameter_list * string mcode (* ) *)
| Array of fullType * string mcode (* [ *) *
expression option * string mcode (* ] *)
| Decimal of string mcode (* decimal *) * string mcode (* ( *) *
diff --git a/parsing_cocci/ast_cocci.mli b/parsing_cocci/ast_cocci.mli
index 5f21664b..7fb54e4d 100644
--- a/parsing_cocci/ast_cocci.mli
+++ b/parsing_cocci/ast_cocci.mli
@@ -325,6 +325,9 @@ and base_typeC =
| FunctionPointer of fullType *
string mcode(* ( *)*string mcode(* * *)*string mcode(* ) *)*
string mcode (* ( *)*parameter_list*string mcode(* ) *)
+ | ParenType of string mcode (* ( *) * fullType * string mcode (* ) *)
+ | FunctionTypeof fullType *
+ string mcode (* ( *) *