aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-22 00:04:47 +0100
committergingerBill <bill@gingerbill.org>2021-04-22 00:04:47 +0100
commit65551ba8fb862a9caef97b3c84b17baa7715bbb6 (patch)
tree633209b38e096e50172463c3aa7b67703ef3336c /src/check_decl.cpp
parentc7d92562c2d8a168687c4dbfc9c31e8797a2365d (diff)
Add `optimization_mode` attribute for procedures
Allowed modes: "none", "minimal", "size", "speed" Currently: none == minimal and size == speed
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 498cde196..e74504a1a 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -707,6 +707,18 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
e->flags |= EntityFlag_Cold;
}
+ e->Procedure.optimization_mode = cast(ProcedureOptimizationMode)ac.optimization_mode;
+
+
+ switch (e->Procedure.optimization_mode) {
+ case ProcedureOptimizationMode_None:
+ case ProcedureOptimizationMode_Minimal:
+ if (pl->inlining == ProcInlining_inline) {
+ error(e->token, "#force_inline cannot be used in conjunction with the attribute 'optimization_mode' with neither \"none\" nor \"minimal\"");
+ }
+ break;
+ }
+
e->Procedure.is_export = ac.is_export;
e->deprecated_message = ac.deprecated_message;
ac.link_name = handle_link_name(ctx, e->token, ac.link_name, ac.link_prefix);