|
1 |
| -\clause{Reduction types} |
| 1 | +\clause{Reduction and spawning function types} |
2 | 2 | \sclause{Introduction}
|
3 | 3 |
|
4 | 4 | \pnum
|
|
16 | 16 | and either thread or allocated storage duration
|
17 | 17 | results in undefined behavior.
|
18 | 18 |
|
| 19 | +\pnum |
| 20 | +The \tcode{_Task _Call} |
| 21 | +qualifier |
| 22 | +(also called the ``spawning function qualifier") |
| 23 | +is in a new syntactic category for qualifiers of function types. |
| 24 | +It can be used to write functions that can spawn tasks |
| 25 | +and return while some of those tasks are still running. |
| 26 | + |
19 | 27 | \sclause{Reduction specifiers}
|
20 | 28 | \ssclause*{Syntax}
|
21 | 29 |
|
|
544 | 552 | so undefined behavior results if it used as if it did.
|
545 | 553 | \end{example}
|
546 | 554 |
|
| 555 | +\sclause{Spawning function types} |
| 556 | + |
| 557 | +\ssclause*{Syntax} |
| 558 | + |
| 559 | +\begin{bnf} |
| 560 | +\nontermdef{spawning-function-qualifier} |
| 561 | +\br |
| 562 | +\terminal{_Task} |
| 563 | +\terminal{_Call} |
| 564 | +\end{bnf} |
| 565 | + |
| 566 | +\ssclause*{Constraints} |
| 567 | + |
| 568 | +\pnum |
| 569 | +A call to a function with spawning function type |
| 570 | +shall appear only within a task spawning call statement. |
| 571 | + |
| 572 | +\ssclause*{Semantics} |
| 573 | + |
| 574 | +\pnum |
| 575 | +A function whose declarator |
| 576 | +includes a spawning function qualifier |
| 577 | +has spawning function type. |
| 578 | +Such a function may return to its caller |
| 579 | +while some of its spawned tasks are still executing. |
| 580 | + |
| 581 | +\begin{example} |
| 582 | +~\\ |
| 583 | +\begin{verbatim} |
| 584 | +int f(void) _Task _Call; |
| 585 | +int (*g1(void) _Task _Call)(void); |
| 586 | +int (*g2(void))(void) _Task _Call; |
| 587 | +\end{verbatim} |
| 588 | + |
| 589 | +\tcode{f} is declared to be a spawning function |
| 590 | +returning \tcode{int}. |
| 591 | +\tcode{g1} is declared to be a spawning function |
| 592 | +returning a pointer to a (non-spawning) function. |
| 593 | +\tcode{g2} is declared to be a (non-spawning) function |
| 594 | +returning a pointer to a spawning function. |
| 595 | + |
| 596 | +\end{example} |
| 597 | + |
547 | 598 | \sclause{Integration with the C standard}
|
548 | 599 |
|
549 | 600 | Change paragraph 7 of subclause 6.2.1 ``Scopes of identifiers":
|
|
577 | 628 | \end{quote}
|
578 | 629 |
|
579 | 630 | Add a new item
|
580 |
| -to the list in paragraph 20 of subclause 6.2.5 ``Types": |
| 631 | +to the list in paragraph 20 of subclause 6.2.5 ``Types" |
| 632 | +(following the item for union types): |
581 | 633 |
|
582 | 634 | \begin{quote}
|
583 | 635 | \begin{itemize}
|
|
593 | 645 | \end{itemize}
|
594 | 646 | \end{quote}
|
595 | 647 |
|
| 648 | +Change sub-bullet of paragraph 20 of subclause 6.2.5: |
| 649 | + |
| 650 | +\begin{quote} |
| 651 | +\begin{itemize} |
| 652 | +\item |
| 653 | +A \textit{function type} |
| 654 | +describes a function |
| 655 | +with specified return type. |
| 656 | +A function type is characterized |
| 657 | +by its return type\added{,} \removed{and} |
| 658 | +the number and types of its parameters |
| 659 | +\added{and its set of function qualifiers}. |
| 660 | +A function type is said to be derived from its return type, |
| 661 | +and if its return type is $T$, |
| 662 | +the function type is sometimes called |
| 663 | +``function returning $T$". |
| 664 | +The construction of a function type from a return type |
| 665 | +is called ``function type derivation". |
| 666 | +\end{itemize} |
| 667 | +\end{quote} |
| 668 | + |
596 | 669 | Change the grammar rule in subclause 6.4.1 ``Keywords",
|
597 | 670 | by adding new alternatives:
|
598 | 671 |
|
|
714 | 787 | or enumeration content. ...
|
715 | 788 | \end{quote}
|
716 | 789 |
|
717 |
| -Change paragraph 9 of 6.7.2.3 ``Tags": |
| 790 | +Change paragraph 9 of 6.7.2.3: |
718 | 791 |
|
719 | 792 | \begin{quote}
|
720 | 793 | If a type specifier of the form
|
|
741 | 814 | and does not redeclare the tag.
|
742 | 815 | \end{quote}
|
743 | 816 |
|
| 817 | +Change the grammar rule in subclause 6.7.6 |
| 818 | +``Declarators": |
| 819 | + |
| 820 | +\begin{quote} |
| 821 | +\begin{bnf} |
| 822 | +\nontermdef{direct-declarator} |
| 823 | +\br |
| 824 | +... |
| 825 | +\br |
| 826 | +direct-declarator \terminal{(} parameter-type-list \terminal{)} |
| 827 | +\added{function-qualifiers\opt} |
| 828 | +\br |
| 829 | +... |
| 830 | +\end{bnf} |
| 831 | +\end{quote} |
| 832 | + |
| 833 | +Add a new grammar rule to 6.7.6: |
| 834 | + |
| 835 | +\begin{quote} |
| 836 | +\begin{bnf} |
| 837 | +\nontermdef{function-qualifiers} |
| 838 | +\br |
| 839 | +spawning-function-qualifier |
| 840 | +\end{bnf} |
| 841 | +\end{quote} |
| 842 | + |
744 | 843 | Change paragraph 1 of subclause 6.7.6.3
|
745 | 844 | ``Function declarations (including prototypes)":
|
746 | 845 |
|
|
750 | 849 | \added{or a reduction type}.
|
751 | 850 | \end{quote}
|
752 | 851 |
|
753 |
| -Add a new paragraph following paragraph 8 of subclause 6.7.6.3 |
754 |
| -``Function declarations (including prototypes)": |
| 852 | +Add a new paragraph following paragraph 8 of subclause 6.7.6.3: |
755 | 853 |
|
756 | 854 | \begin{quote}
|
757 | 855 | A declaration of a parameter as a reduction type
|
758 | 856 | shall be adjusted to be a pointer to the same reduction type.
|
759 | 857 | \end{quote}
|
760 | 858 |
|
| 859 | +Change paragraph 15 of subclause 6.7.6.3: |
| 860 | + |
| 861 | +\begin{quote} |
| 862 | +For two function types to be compatible, |
| 863 | +both shall specify compatible |
| 864 | +return types\removed{.}\added{,}$^{146)}$ |
| 865 | +\added{and both shall specify equivalent |
| 866 | +sets of function qualifiers.} |
| 867 | +Moreover, the parameter type lists, if both are present, shall agree in the number of |
| 868 | +parameters and in use of the ellipsis terminator; corresponding parameters shall have |
| 869 | +compatible types. |
| 870 | +... |
| 871 | +\end{quote} |
| 872 | + |
| 873 | +Change the grammar rule in subclause 6.7.7 ``Type names": |
| 874 | + |
| 875 | +\begin{quote} |
| 876 | +\begin{bnf} |
| 877 | +\nontermdef{direct-abstract-declarator} |
| 878 | +\br |
| 879 | +... |
| 880 | +\br |
| 881 | +direct-abstract-declarator\opt{} |
| 882 | +\terminal{(} parameter-type-list\opt{} \terminal{)} |
| 883 | +\added{function-qualifiers\opt} |
| 884 | +\end{bnf} |
| 885 | +\end{quote} |
| 886 | + |
761 | 887 | Add a new paragraph following paragraph 8
|
762 | 888 | of subclause 6.7.9 ``Initializers":
|
763 | 889 |
|
|
0 commit comments