Skip to content

Commit 600cae7

Browse files
[LangRef] Try to clarify mustprogress wording. (#90510)
Ensure it's clear that: - Infinite loops in non-mustprogress functions are well-defined, even if they're called by mustprogress functions. - Infinite recursion in mustprogress functions is not well-defined. Looking at D86233, it's clear this was the intent, but the "transitive" wording is ambiguous. Instead, just explicitly state that infinite loops written in non-mustprogress functions count as progress.
1 parent 30badf9 commit 600cae7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/docs/LangRef.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,12 +2447,14 @@ example:
24472447
memory access, I/O, or other synchronization. The ``mustprogress``
24482448
attribute is intended to model the requirements of the first section of
24492449
[intro.progress] of the C++ Standard. As a consequence, a loop in a
2450-
function with the `mustprogress` attribute can be assumed to terminate if
2450+
function with the ``mustprogress`` attribute can be assumed to terminate if
24512451
it does not interact with the environment in an observable way, and
2452-
terminating loops without side-effects can be removed. If a `mustprogress`
2453-
function does not satisfy this contract, the behavior is undefined. This
2454-
attribute does not apply transitively to callees, but does apply to call
2455-
sites within the function. Note that `willreturn` implies `mustprogress`.
2452+
terminating loops without side-effects can be removed. If a ``mustprogress``
2453+
function does not satisfy this contract, the behavior is undefined. If a
2454+
``mustprogress`` function calls a function not marked ``mustprogress``,
2455+
and that function never returns, the program is well-defined even if there
2456+
isn't any other observable progress. Note that ``willreturn`` implies
2457+
``mustprogress``.
24562458
``"warn-stack-size"="<threshold>"``
24572459
This attribute sets a threshold to emit diagnostics once the frame size is
24582460
known should the frame size exceed the specified value. It takes one

0 commit comments

Comments
 (0)