Skip to content

Commit

Permalink
Make GenerateEvents imply inlining. (modelica#3065)
Browse files Browse the repository at this point in the history
* Make GenerateEvents imply inlining.
* Clarify that diagnostics if not generating events.
* Clarify that GenerateEvents=true doesn't matter if the function is called where events cannot be generated.
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
  • Loading branch information
HansOlsson committed Feb 10, 2022
1 parent 12fbea0 commit d6cb901
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chapters/functions.tex
Expand Up @@ -1881,10 +1881,17 @@ \section{Function Inlining and Event Generation}\label{function-inlining-and-eve
"GenerateEvents" "=" ( false | true )
\end{lstlisting}\end{synopsis}
\begin{semantics}
Has only an effect within a function declaration
Has only an effect within a function declaration.

By default, \lstinline!GenerateEvents = false! and expressions in the function body that would normally be event-generating shall not generate events, similar to inlining the function body while wrapping all expressions in \lstinline!noEvent!, see \cref{modelica:noEvent}.
By specifying \lstinline!GenerateEvents = true!, event-generating expressions in the function body shall generate events as normal, similar to inlining the function body without wrapping all expressions in \lstinline!noEvent!.
Having \lstinline!GenerateEvents = true! implies \lstinline!Inline = true! unless overridden by specifying one of the inlining annotations with value \lstinline!true! (in particular, \lstinline!GenerateEvents = true! cannot be combined with \lstinline!Inline = false!).

If \lstinline!GenerateEvents = true!, the model developer proposes that crossing functions in the function should generate events (one possibility of doing this is to inline the function and generate events for the inlined function).
\begin{nonnormative}
In case a given inlining annotation proposes to inline at a stage when the tool cannot process \lstinline!GenerateEvents = true!, it is recommended to give a diagnostic and instead perform inlining of the function at the nearest stage where \lstinline!GenerateEvents = true! can still be respected.

If the function is called in a context where events will not be generated (e.g., inside another function without \lstinline!GenerateEvents = true!) no special action is needed.
\end{nonnormative}
\end{semantics}
\end{annotationdefinition}

Expand Down

0 comments on commit d6cb901

Please sign in to comment.