Package: groff
Version: 1.22.4-10
Severity: normal

Dear Maintainer,

nabijaczleweli@tarta:~/code/wg14$ pdfmom -Tps -K utf-8 N????.mom > /dev/null
troff: N????.mom:5: can't transparently output node at top level
troff: N????.mom:5: can't transparently output node at top level
troff: N????.mom:5: can't transparently output node at top level
troff: N????.mom:5: can't transparently output node at top level
troff: N????.mom:5: can't transparently output node at top level
troff: Failed assertion at line 524, file '../../src/roff/troff/input.cpp'.
/bin/groff: troff: Signal 6
grops:<standard input> (N????.mom):6736: warning: no final 'x stop' command
GPL Ghostscript 10.00.0: Unrecoverable error, exit code 1

nabijaczleweli@szarotka:~/tarta.d/code/wg14$ pdfmom -Tps -K utf-8 NHLOCS~L.MOM 
> /dev/null
troff: NHLOCS~L.MOM:5: warning: can't find special character 'u043D'
troff: NHLOCS~L.MOM:5: warning: can't find special character 'u0430'
troff: NHLOCS~L.MOM:5: warning: can't find special character 'u0431'
troff: NHLOCS~L.MOM:5: can't transparently output node at top level
troff: NHLOCS~L.MOM:5: can't transparently output node at top level
troff: Failed assertion at line 524, file '../../src/roff/troff/input.cpp'.
/bin/groff: troff: Signal 6
grops:<standard input> (NHLOCS~L.MOM):5525: warning: no final 'x stop' command
GPL Ghostscript 10.03.1: Unrecoverable error, exit code 1

bookworm and sid ghostscript, resp., but troff does indeed SIGABRT.
1.22.4-10 and 1.22.4-9, resp.
(Same file, just 8.3-mangled over SMB.)

I'm attaching both the file that triggers this,
and a version from a few minutes prior that didn't,
so this should be trivial to bisect, at least.

Best,

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: amd64, i386

Kernel: Linux 6.7.7-amd64 (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FORCED_MODULE, 
TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages groff depends on:
ii  groff-base          1.22.4-9
ii  libc6               2.38-13
ii  libgcc-s1           14-20240221-2.1
ii  libstdc++6          14-20240221-2.1
ii  libx11-6            2:1.8.7-1
ii  libxaw7             2:1.0.14-1
ii  libxmu6             2:1.1.3-3
ii  libxt6t64 [libxt6]  1:1.2.1-1.2

Versions of packages groff recommends:
ii  ghostscript  10.03.1~dfsg-2
pn  imagemagick  <none>
ii  libpaper1    1.1.29
pn  netpbm       <none>
ii  perl         5.36.0-10
pn  psutils      <none>

groff suggests no packages.

-- no debconf information
.\" SPDX-License-Identifier: 0BSD
.\"
.TITLE     "\fIN????\fP\f(CR: \fP\f(CBstdarg.h\fP wording\f(CR...\f(CR\fP"
.PDF_TITLE "\*[$TITLE]
.AUTHOR    "\v'-.5v'\*[UP 8p]наб, seb, rCs"
.\" http://www.open-std.org/jtc1/sc22/wg14/www/contributing says we need a 
cover page
.SUBTITLE      "\s9\f(CBstdarg.h\fR, especially in C2x, is byzantine." \
               "\v'-.3v'Modernising the language can alleviate this."
.ATTRIBUTE_STRING ""  \" Drop 'by'
.HEADER_LEFT "наб, seb, rCs"
.COVER       TITLE SUBTITLE AUTHOR
.PDF_BOOKMARKS_OPEN
.\" Page, style, formatting
.PRINTSTYLE TYPESET
.PAPER      A4
.L_MARGIN   2c
.R_MARGIN   2c
.\"
.FAM      T
.FT       R
.PT_SIZE  10.5
.AUTOLEAD 3
.\"
.INDENT_FIRST_PARAS
.PARA_INDENT 6p
.\"
.COVER_LEAD     +3.5
.DOCHEADER_LEAD +3.5
.\" Color for code snippets
.XCOLOR    darkgreen green
.XCOLOR        red   red
.XCOLOR        blue blue
.NEWCOLOUR darkwhite RGB #909090
.\"
.QUOTE_FAMILY C
.QUOTE_FONT   B
.QUOTE_INDENT 9p
.\"
.HEADING_STYLE 1 NUMBER FONT B SIZE +1  BASELINE_ADJUST \n[.v]/5
.HEADING_STYLE 2 NUMBER FONT I SIZE +.5 BASELINE_ADJUST \n[.v]/5
.HEADING_STYLE 3 NUMBER FONT R SIZE 0   BASELINE_ADJUST \n[.v]/5
.\" Wrapper around QUOTE
.de COD
. QUOTE
. nop \\$*
. QUOTE OFF
..
.
.ds va_list  \*[blue]\f(CBva_list\fP\*[black]
.ds ap       \*[blue]\f(CRap\fP\*[black]
.ds va_macros \*[green]\f(CBva_…\fP\*[black]
.ds va_start \*[green]\f(CBva_start\fP\*[black]
.ds va_arg   \*[green]\f(CBva_arg\fP\*[black]
.ds va_copy  \*[green]\f(CBva_copy\fP\*[black]
.ds va_end   \*[green]\f(CBva_end\fP\*[black]
.ds stdarg.h \f(CR<stdarg.h>\fP
.
.\" Note box
.de BOX-NOTE
. ie \\n[#NUM_ARGS]=1 .DBX .5 0 \\n[.l]u \\$1
. el .DBX .5 0 \\$1 \\$2
. ALD 15p
. IB 6p
..
.\" Table of contents
.SPACE_TOC_ITEMS
.AUTO_RELOCATE_TOC
.TOC_ENTRY_STYLE 2 FONT I
.\"
.DOCHEADER_ADVANCE 4.5c \" Begin this distance down from top of page
.\"
.START
.
.RLD 0.75cm
Document #:\h'|1i'????
.br
Date:\h'|1i'2024-06-21
.br
Revisions:\h'|1i'\c
.PDF_WWW_LINK http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3285.pdf N3285
.br
Project:\h'|1i'Programming Language C
.br
Reply-to:\h'|1i'наб
.PDF_WWW_LINK mailto:nabijaczlew...@nabijaczleweli.xyz PREFIX < SUFFIX > 
nabijaczlew...@nabijaczleweli.xyz
.IBQ
.
.\"
.HEADING 1 NAMED intro "Casus belli"
.PP
seb
.PDF_WWW_LINK https://jittr.click/@sebastian PREFIX < SUFFIX > 
@sebastian@jittr.click
had identified a series of inconsistencies both in the wording of 
\f(CBstdarg.h\fP in the current draft C2X standard
.PDF_WWW_LINK http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3301.pdf N3301
and in compilers' interpretations thereof.
These have been refined in subsequent discussion, this paper presents a summary 
of diffs, along with rationales.
.PP
Comments on the previous revision of this paper also agree with the desire to 
standardise the nomenclature \(em
the subclause referred to the same concept ad lib as "varying arguments" and 
"unnamed arguments", i.a. compound nouns thereof \(em
the concept of a "variadic function" is defined and replaced greedily.
.
.HEADING 1 NAMED wording "Proposed wording"
.de QUOTELINE
.DRV 4 .5c \\$1v-1v \\$2
.DRV 4 .5c  -.7v \\$2
..
.HEADING 2 NAMED "7.16.1-stdarg.h" "7.16.1 (\*[stdarg.h], …)"
.QUOTELINE 2 red
.in +1cm
.nf
\h'-1m'\z1\h'1m'\c
The header \*[stdarg.h] declares a type and defines five macros, for advancing 
through a list of
arguments whose number and types are not known to the called function when it 
is translated.
\h'-1m'\z3\h'1m'\c
A function may be called with a variable number of arguments of varying types 
if its parameter
type list ends with an ellipsis.
.fi
.in -1cm
replace with
.QUOTELINE 3 green
.in +1cm
\h'-1m'\z1\h'1m'\c
The header \*[stdarg.h] declares a type and defines five macros and functions,
for use with variadic functions.
Variadic functions accept a list of arguments whose number and types
are not known to the called function when it is translated.
\h'-1m'\z3\h'1m'\c
A function is variadic if its parameter type list ends with an ellipsis.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.1-stdarg.h" "Rationale"
.PP
As above, so below.
Also, clearly note that some of these can be either, not \fIjust\fP macros.
.
.HEADING 2 NAMED "7.16.1-va_list" "7.16.1 (\*[va_list])"
.QUOTELINE 9 darkwhite
.in +1cm
.nf
\h'-1m'\z4\h'1m'\c
The type declared is
.ti +1cm
\*[va_list]
which is a complete object type suitable for holding information needed by the 
macros \*[va_start],
\*[va_arg], \*[va_end], and \*[va_copy].  If access to the varying arguments is 
desired, the called function
shall declare an object (generally referred to as \*[ap] in this subclause) 
having type \*[va_list]. The object
\*[ap] may be passed as an argument to another function; if that function 
invokes the \*[va_arg] macro
with parameter \*[ap], the representation of \*[ap] in the calling function is 
indeterminate and shall be
passed to the \*[va_end] macro prior to any further reference to 
\*[ap].\*[SUP]292)\*[SUPX] Whether a byte copy of \*[va_list]
can be used in place of the original is implementation-defined.
.fi
.in -1cm
Replace
.QUOTELINE 2 red
.in +1cm
.nf
\*[va_arg], \*[va_end], and \*[va_copy].  If access to the varying arguments is 
desired, the called function
shall declare an object (generally referred to as \*[ap] in this subclause) 
having type \*[va_list].
.fi
.in -1cm
with
.QUOTELINE 2 green
.in +1cm
\*[va_arg], \*[va_end], and \*[va_copy] to access the varying arguments.
Objects of type \*[va_list] are generally referred to as \*[ap] in this 
subclause.
.in -1cm
.sp 1
.bp
and replace
.QUOTELINE 4 red
.in +1cm
.nf
\h'\w'shall declare an object (generally referred to as \*[ap] in this 
subclause) having type \*[va_list].'u' The object
\*[ap] may be passed as an argument to another function; if that function 
invokes the \*[va_arg] macro
with parameter \*[ap], the representation of \*[ap] in the calling function is 
indeterminate and shall be
passed to the \*[va_end] macro prior to any further reference to 
\*[ap].\u\s-3292)\s+3\d
.fi
.in -1cm
with
.QUOTELINE 3 green
.in +1cm
If an \*[ap] object is passed as an argument to another function
and that function invokes the \*[va_arg] macro on \*[ap] then the 
representation of \*[ap] in the calling function is indeterminate
and \*[ap] shall be passed to the \*[va_end] macro before being passed to any 
other \*[va_macros] macros.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.1-va_list" "Rationale"
.PP
Beside updating the ancient-style wording ("if … is desired, the function … 
shall"),
it hinted at a restrixion of where \*[va_list]s may be created.
There are none such.
.PP
"reference to" is clarified to be w.r.t. the other \*[va_macros] macros 
exclusively.
It's still a valid object, it's entirely valid to, for example, take its 
address.
.
.HEADING 2 NAMED "7.16.2.1" "7.16.2.1"
.QUOTELINE 6 darkwhite
.in +1cm
.nf
\h'-1m'\z1\h'1m'\c
The \*[va_start] and \*[va_arg] macros described in this subclause shall be 
implemented as macros, not
functions. It is unspecified whether \*[va_copy] and \*[va_end] are macros or 
identifiers declared with
external linkage.  If a macro definition is suppressed to access an actual 
function, or a program
defines an external identifier with the same name, the behavior is undefined. 
Each invocation of
the \*[va_start] and \*[va_copy] macros shall be matched by a corresponding 
invocation of the \*[va_end]
macro in the same function.
.fi
.in -1cm
Append:
.QUOTELINE 2 green
.in +1cm
The \*[va_list] argument given to every macro defined in this subclause shall 
be an lvalue of this type
or the result of array-to-pointer decay of such an lvalue.
.in -1cm
and append or add footnote:
.QUOTELINE 2 green
.in +1cm
For conciseness only, this subclause refers to \*[va_copy] and \*[va_end] just 
as "macros".
This is to be understood as a short-hand, not as constraining only one of the 
possible implementations.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.2.1" "Rationale"
.PP
This codifies existing practice, since the macros modify \*[ap],
allthewhile it must be allowed to be passed to \fIfunctions\fP,
wherein \*[va_list] decays to a pointer if it's an array type,
verbatim.
.PP
Kinda odd that it says these can be macros \fIor\fP symbols but then it calls 
them macros, innit.
If it said "the \*[va_end] macro or symbol" then that would be worse though.
.
.HEADING 2 NAMED "7.16.2.5" "7.16.2.5"
.QUOTELINE 1 red
.in +1cm
\h'-1m'\z2\h'1m'\c
The \*[va_start] macro shall be invoked before any access to the unnamed 
arguments.
.in -1cm
replace with
.QUOTELINE 2 green
.in +1cm
\h'-1m'\z2\h'1m'\c
The \*[va_start] macro may only be invoked in the block scope of a function 
whose parameter type list ends with an ellipsis.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.2.5" "Rationale"
.PP
There is no other way to access the unnamed arguments (pt. 3 defines the way 
\*[va_start] facilitates this) anyway, so this can be deleted.
.PP
Currently, the way this limits where the standard allows \*[va_start] to be 
invoked is strictly by domain error of the counterfactual (if there are no 
unnamed arguments).
Can you use \*[va_start] if there is an ellipsis but no unnamed arguments were 
given?
Yes.
Does the current wording allow it?
No, for the same reason.
.PP
Even then, this allows
.COD "void f(va_list ap, int [(va_start(ap), 1)], ...) { va_end(ap); }"
which makes little sense,
and yet GCC permits it,
while Clang refuses it (\f(CR'va_start' cannot be used outside a function\fP).
This limits \*[va_start] to the scopes where it's meaningful.
.
.HEADING 1 NAMED wording "Proposed wording (variadic)"
.
.HEADING 1 NAMED references "References"
The seminal post:
.PDF_WWW_LINK https://jittr.click/@sebastian/statuses/01HYYTSHPDNAFDNQSTXVXYSAY2
.br
Joseph Myers' \fIPre-DR#8: va_list objects\fP (as reference for this paper's 
\fI2.2\fP diff 1):
.PDF_WWW_LINK https://www.polyomino.org.uk/computer/c/pre-dr-8.txt
.
.TOC
.\" SPDX-License-Identifier: 0BSD
.\"
.TITLE     "\fIN????\fP\f(CR: \fP\f(CBstdarg.h\fP wording\f(CR...\f(CR\fP"
.PDF_TITLE "\*[$TITLE]
.AUTHOR    "\v'-.5v'\*[UP 8p]наб, seb, rCs"
.\" http://www.open-std.org/jtc1/sc22/wg14/www/contributing says we need a 
cover page
.SUBTITLE      "\s9\f(CBstdarg.h\fR, especially in C2x, is byzantine." \
               "\v'-.3v'Modernising the language can alleviate this."
.ATTRIBUTE_STRING ""  \" Drop 'by'
.HEADER_LEFT "наб, seb, rCs"
.COVER       TITLE SUBTITLE AUTHOR
.PDF_BOOKMARKS_OPEN
.\" Page, style, formatting
.PRINTSTYLE TYPESET
.PAPER      A4
.L_MARGIN   2c
.R_MARGIN   2c
.\"
.FAM      T
.FT       R
.PT_SIZE  10.5
.AUTOLEAD 3
.\"
.INDENT_FIRST_PARAS
.PARA_INDENT 6p
.\"
.COVER_LEAD     +3.5
.DOCHEADER_LEAD +3.5
.\" Color for code snippets
.XCOLOR    darkgreen green
.XCOLOR        red   red
.XCOLOR        blue blue
.NEWCOLOUR darkwhite RGB #909090
.\"
.QUOTE_FAMILY C
.QUOTE_FONT   B
.QUOTE_INDENT 9p
.\"
.HEADING_STYLE 1 NUMBER FONT B SIZE +1  BASELINE_ADJUST \n[.v]/5
.HEADING_STYLE 2 NUMBER FONT I SIZE +.5 BASELINE_ADJUST \n[.v]/5
.HEADING_STYLE 3 NUMBER FONT R SIZE 0   BASELINE_ADJUST \n[.v]/5
.\" Wrapper around QUOTE
.de COD
. QUOTE
. nop \\$*
. QUOTE OFF
..
.
.ds va_list  \*[blue]\f(CBva_list\fP\*[black]
.ds ap       \*[blue]\f(CRap\fP\*[black]
.ds va_macros \*[green]\f(CBva_…\fP\*[black]
.ds va_start \*[green]\f(CBva_start\fP\*[black]
.ds va_arg   \*[green]\f(CBva_arg\fP\*[black]
.ds va_copy  \*[green]\f(CBva_copy\fP\*[black]
.ds va_end   \*[green]\f(CBva_end\fP\*[black]
.ds stdarg.h \f(CR<stdarg.h>\fP
.
.\" Note box
.de BOX-NOTE
. ie \\n[#NUM_ARGS]=1 .DBX .5 0 \\n[.l]u \\$1
. el .DBX .5 0 \\$1 \\$2
. ALD 15p
. IB 6p
..
.\" Table of contents
.SPACE_TOC_ITEMS
.AUTO_RELOCATE_TOC
.TOC_ENTRY_STYLE 2 FONT I
.\"
.DOCHEADER_ADVANCE 4.5c \" Begin this distance down from top of page
.\"
.START
.
.RLD 0.75cm
Document #:\h'|1i'????
.br
Date:\h'|1i'2024-06-21
.br
Revisions:\h'|1i'\c
.PDF_WWW_LINK http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3285.pdf N3285
.br
Project:\h'|1i'Programming Language C
.br
Reply-to:\h'|1i'наб
.PDF_WWW_LINK mailto:nabijaczlew...@nabijaczleweli.xyz PREFIX < SUFFIX > 
nabijaczlew...@nabijaczleweli.xyz
.IBQ
.
.\"
.HEADING 1 NAMED intro "Casus belli"
.PP
seb
.PDF_WWW_LINK https://jittr.click/@sebastian PREFIX < SUFFIX > 
@sebastian@jittr.click
had identified a series of inconsistencies both in the wording of 
\f(CBstdarg.h\fP in the current draft C2X standard
.PDF_WWW_LINK http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3301.pdf N3301
and in compilers' interpretations thereof.
These have been refined in subsequent discussion, this paper presents a summary 
of diffs, along with rationales.
.PP
Comments on the previous revision of this paper also agree with the desire to 
standardise the nomenclature \(em
the subclause referred to the same concept ad lib as "varying arguments" and 
"unnamed arguments", i.a. compound nouns thereof \(em
the concept of a "variadic function" is defined and replaced greedily.
.
.HEADING 1 NAMED wording "Proposed wording"
.de QUOTELINE
.DRV 4 .5c \\$1v-1v \\$2
.DRV 4 .5c  -.7v \\$2
..
.HEADING 2 NAMED "7.16.1-stdarg.h" "7.16.1 (\*[stdarg.h], ellipsis)"
.QUOTELINE 2 red
.in +1cm
.nf
\h'-1m'\z1\h'1m'\c
The header \*[stdarg.h] declares a type and defines five macros, for advancing 
through a list of
arguments whose number and types are not known to the called function when it 
is translated.
.fi
.in -1cm
replace with
.QUOTELINE 3 green
.in +1cm
\h'-1m'\z1\h'1m'\c
The header \*[stdarg.h] declares a type and defines five macros and functions,
for use with variadic functions.
Variadic functions accept a list of arguments whose number and types
are not known to the called function when it is translated.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.1-stdarg.h" "Rationale"
.PP
As above, so below.
Also, clearly note that some of these can be either, not \fIjust\fP macros.
.
.HEADING 2 NAMED "7.16.1-va_list" "7.16.1 (\*[va_list])"
.QUOTELINE 9 darkwhite
.in +1cm
.nf
\h'-1m'\z4\h'1m'\c
The type declared is
.ti +1cm
\*[va_list]
which is a complete object type suitable for holding information needed by the 
macros \*[va_start],
\*[va_arg], \*[va_end], and \*[va_copy].  If access to the varying arguments is 
desired, the called function
shall declare an object (generally referred to as \*[ap] in this subclause) 
having type \*[va_list]. The object
\*[ap] may be passed as an argument to another function; if that function 
invokes the \*[va_arg] macro
with parameter \*[ap], the representation of \*[ap] in the calling function is 
indeterminate and shall be
passed to the \*[va_end] macro prior to any further reference to 
\*[ap].\*[SUP]292)\*[SUPX] Whether a byte copy of \*[va_list]
can be used in place of the original is implementation-defined.
.fi
.in -1cm
Replace
.QUOTELINE 2 red
.in +1cm
.nf
\*[va_arg], \*[va_end], and \*[va_copy].  If access to the varying arguments is 
desired, the called function
shall declare an object (generally referred to as \*[ap] in this subclause) 
having type \*[va_list].
.fi
.in -1cm
with
.QUOTELINE 2 green
.in +1cm
\*[va_arg], \*[va_end], and \*[va_copy] to access the varying arguments.
Objects of type \*[va_list] are generally referred to as \*[ap] in this 
subclause.
.in -1cm
.sp 1
.bp
and replace
.QUOTELINE 4 red
.in +1cm
.nf
\h'\w'shall declare an object (generally referred to as \*[ap] in this 
subclause) having type \*[va_list].'u' The object
\*[ap] may be passed as an argument to another function; if that function 
invokes the \*[va_arg] macro
with parameter \*[ap], the representation of \*[ap] in the calling function is 
indeterminate and shall be
passed to the \*[va_end] macro prior to any further reference to 
\*[ap].\u\s-3292)\s+3\d
.fi
.in -1cm
with
.QUOTELINE 3 green
.in +1cm
If an \*[ap] object is passed as an argument to another function
and that function invokes the \*[va_arg] macro on \*[ap] then the 
representation of \*[ap] in the calling function is indeterminate
and \*[ap] shall be passed to the \*[va_end] macro before being passed to any 
other \*[va_macros] macros.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.1-va_list" "Rationale"
.PP
Beside updating the ancient-style wording ("if … is desired, the function … 
shall"),
it hinted at a restrixion of where \*[va_list]s may be created.
There are none such.
.PP
"reference to" is clarified to be w.r.t. the other \*[va_macros] macros 
exclusively.
It's still a valid object, it's entirely valid to, for example, take its 
address.
.
.HEADING 2 NAMED "7.16.2.1" "7.16.2.1"
.QUOTELINE 6 darkwhite
.in +1cm
.nf
\h'-1m'\z1\h'1m'\c
The \*[va_start] and \*[va_arg] macros described in this subclause shall be 
implemented as macros, not
functions. It is unspecified whether \*[va_copy] and \*[va_end] are macros or 
identifiers declared with
external linkage.  If a macro definition is suppressed to access an actual 
function, or a program
defines an external identifier with the same name, the behavior is undefined. 
Each invocation of
the \*[va_start] and \*[va_copy] macros shall be matched by a corresponding 
invocation of the \*[va_end]
macro in the same function.
.fi
.in -1cm
Append:
.QUOTELINE 2 green
.in +1cm
The \*[va_list] argument given to every macro defined in this subclause shall 
be an lvalue of this type
or the result of array-to-pointer decay of such an lvalue.
.in -1cm
and append or add footnote:
.QUOTELINE 2 green
.in +1cm
For conciseness only, this subclause refers to \*[va_copy] and \*[va_end] just 
as "macros".
This is to be understood as a short-hand, not as constraining only one of the 
possible implementations.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.2.1" "Rationale"
.PP
This codifies existing practice, since the macros modify \*[ap],
allthewhile it must be allowed to be passed to \fIfunctions\fP,
wherein \*[va_list] decays to a pointer if it's an array type,
verbatim.
.PP
Kinda odd that it says these can be macros \fIor\fP symbols but then it calls 
them macros, innit.
If it said "the \*[va_end] macro or symbol" then that would be worse though.
.
.HEADING 2 NAMED "7.16.2.5" "7.16.2.5"
.QUOTELINE 1 red
.in +1cm
\h'-1m'\z2\h'1m'\c
The \*[va_start] macro shall be invoked before any access to the unnamed 
arguments.
.in -1cm
replace with
.QUOTELINE 2 green
.in +1cm
\h'-1m'\z2\h'1m'\c
The \*[va_start] macro may only be invoked in the block scope of a function 
whose parameter type list ends with an ellipsis.
.in -1cm
.
.HEADING 3 NAMED "rationale-7.16.2.5" "Rationale"
.PP
There is no other way to access the unnamed arguments (pt. 3 defines the way 
\*[va_start] facilitates this) anyway, so this can be deleted.
.PP
Currently, the way this limits where the standard allows \*[va_start] to be 
invoked is strictly by domain error of the counterfactual (if there are no 
unnamed arguments).
Can you use \*[va_start] if there is an ellipsis but no unnamed arguments were 
given?
Yes.
Does the current wording allow it?
No, for the same reason.
.PP
Even then, this allows
.COD "void f(va_list ap, int [(va_start(ap), 1)], ...) { va_end(ap); }"
which makes little sense,
and yet GCC permits it,
while Clang refuses it (\f(CR'va_start' cannot be used outside a function\fP).
This limits \*[va_start] to the scopes where it's meaningful.
.
.HEADING 1 NAMED wording "Proposed wording (variadic)"
.
.HEADING 1 NAMED references "References"
The seminal post:
.PDF_WWW_LINK https://jittr.click/@sebastian/statuses/01HYYTSHPDNAFDNQSTXVXYSAY2
.br
Joseph Myers' \fIPre-DR#8: va_list objects\fP (as reference for this paper's 
\fI2.2\fP diff 1):
.PDF_WWW_LINK https://www.polyomino.org.uk/computer/c/pre-dr-8.txt
.
.TOC

Attachment: signature.asc
Description: PGP signature

Reply via email to