aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-02-19 19:56:16 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2017-02-19 19:56:16 +0100
commit2994087f111a1fc8e9d52cb9370dfdd9c0157f00 (patch)
treeda992238ec64cfa8de0a9462ba0aa7634727dbc4
parentaa59d2dd11570e8cea3d8c429b94acf1001e2cc6 (diff)
downloadcompcert-2994087f111a1fc8e9d52cb9370dfdd9c0157f00.tar.gz
compcert-2994087f111a1fc8e9d52cb9370dfdd9c0157f00.zip
Added gcc noinline attribute.
The noinline attribute prevents functions from inlining.
-rw-r--r--cfrontend/C2C.ml1
-rw-r--r--cparser/Elab.ml1
2 files changed, 2 insertions, 0 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index eecda71b..3bd1eea0 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -271,6 +271,7 @@ let attributes = [
("packed", Cutil.Attr_struct);
(* function-related *)
("noreturn", Cutil.Attr_function);
+ ("noinline",Cutil.Attr_function);
(* name-related *)
("section", Cutil.Attr_name);
("unused", Cutil.Attr_name)
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 050bdf6c..07351c46 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -2365,6 +2365,7 @@ let elab_fundef env spec name defs body loc =
&& can_return then
warning loc Invalid_noreturn "function '%s' declared 'noreturn' should not return" s;
(* Build and emit function definition *)
+ let inline = inline && find_custom_attributes ["noinline";"__noinline__"] attr = [] in
let fn =
{ fd_storage = sto1;
fd_inline = inline;