aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend/C2C.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-02-03 14:12:32 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2017-02-03 14:12:32 +0100
commit3babd253e1d194549294c282e1b0c60097b26b07 (patch)
treef6a4ed3152aafdac8474350c31a9e7a5fcdb20c6 /cfrontend/C2C.ml
parent47c82de6010935d11c3d64f6d06c2061c34dc091 (diff)
downloadcompcert-kvx-3babd253e1d194549294c282e1b0c60097b26b07.tar.gz
compcert-kvx-3babd253e1d194549294c282e1b0c60097b26b07.zip
Refactor the classification of attributes
Introduce Cutil.class_of_attribute to return the class of the given attribute: one among Attr_type attribute related to types (e.g. "aligned") Attr_struct attribute related to struct/union/enum types (e.g. "packed") Attr_function attribute related to function types (e.g. "noreturn") Attr_name attribute related to variable and function declarations (e.g. "section") Attr_unknown attribute was not declared Cutil.declare_attribute is used to associate a class to a custom attribute. Standard attributes (const, volatile, _Alignas, etc) are Attr_type. cfronted/C2C.ml: declare the few attributes that CompCert honors currently. cparser/GCC.ml: a bigger list of attributes taken from GCC, for reference only.
Diffstat (limited to 'cfrontend/C2C.ml')
-rw-r--r--cfrontend/C2C.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index b7fe5fb0..183af347 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -267,6 +267,19 @@ let builtins =
{ typedefs = builtins_generic.typedefs @ CBuiltins.builtins.typedefs;
functions = builtins_generic.functions @ CBuiltins.builtins.functions }
+(** ** The known attributes *)
+
+let attributes = [
+ (* type-related *)
+ ("aligned", Cutil.Attr_type);
+ (* struct-related *)
+ ("packed", Cutil.Attr_struct);
+ (* function-related (currently none) *)
+ (* name-related *)
+ ("section", Cutil.Attr_name)
+]
+
+
(** ** Functions used to handle string literals *)
let stringNum = ref 0 (* number of next global for string literals *)