Skip to content

Commit f083456

Browse files
committed
perlapi: Combine vwarner and similar with warner entry
This commit places all similar functions into the same entry, making it easier for the reader to choose which is best for their needs.
1 parent 8777114 commit f083456

File tree

2 files changed

+25
-32
lines changed

2 files changed

+25
-32
lines changed

autodoc.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
sv_setpvf
9797
sv_setpvf_mg
9898
warn
99-
warner
10099
);
101100
my %has_compat_macro;
102101
$has_compat_macro{$_} = 1 for @have_compatibility_macros;

util.c

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,18 +2049,30 @@ Perl_warn(pTHX_ const char *pat, ...)
20492049
}
20502050

20512051
/*
2052-
=for apidoc warner
2052+
=for apidoc warner
20532053
=for apidoc_item warner_nocontext
2054+
=for apidoc_item vwarner
2055+
=for apidoc_item fatal_warner
2056+
=for apidoc_item vfatal_warner
20542057
20552058
These output a warning of the specified category (or categories) given by
2056-
C<err>, using the sprintf-style format pattern C<pat>, and argument list.
2059+
C<err>, using the sprintf-style format pattern C<pat>, and the arguments.
20572060
20582061
C<err> must be one of the C<L</packWARN>>, C<packWARN2>, C<packWARN3>,
20592062
C<packWARN4> macros populated with the appropriate number of warning
2060-
categories. If any of the warning categories they specify is fatal, a fatal
2063+
categories.
2064+
2065+
If any of the warning categories they specify is fatal, a fatal
20612066
exception is thrown.
20622067
2063-
In any event a message is generated by the pattern and arguments. If the
2068+
C<fatal_warner> and C<vfatal_warner> act as if fatal warnings are enabled
2069+
for the warning. If called when there are pending compilation errors these
2070+
functions may actually return. They are currently used to generate "used only
2071+
once" fatal warnings since the COP where the name being reported is no longer
2072+
the current COP when the warning is generated and may be useful for similar
2073+
cases.
2074+
2075+
In any event, a message is generated by the pattern and arguments. If the
20642076
message does not end with a newline, then it will be extended with some
20652077
indication of the current location in the code, as described for L</mess_sv>.
20662078
@@ -2069,13 +2081,18 @@ but this is subject to modification by a C<$SIG{__WARN__}> handler.
20692081
20702082
C<pat> is not permitted to be null.
20712083
2072-
The two forms differ only in that C<warner_nocontext> does not take a thread
2073-
context (C<aTHX>) parameter, so is used in situations where the caller doesn't
2074-
already have the thread context.
2084+
The arguments to C<vwarner> and C<vfatal_warner> are specified as a
2085+
C<va_list>. The arguments to the remaining forms are specified as a
2086+
sprintf-style list of arguments.
2087+
2088+
C<warner> and C<warner_nocontext> behave identically when called from outside
2089+
the perl core unless C<PERL_WANT_VARARGS> has been explicitly #defined.
2090+
When it has, or when called from inside the core, they differ only in that
2091+
C<warner> requires the thread context (C<aTHX>) to be available.
20752092
20762093
These functions differ from the similarly named C<L</warn>> functions, in that
20772094
the latter are for XS code to unconditionally display a warning, whereas these
2078-
are for code that may be compiling a perl program, and does extra checking to
2095+
are for code that may be compiling a perl program, and do extra checking to
20792096
see if the warning should be fatal.
20802097
20812098
=for apidoc ck_warner
@@ -2091,29 +2108,6 @@ categories.
20912108
The two forms differ only in that C<ck_warner_d> should be used if warnings for
20922109
any of the categories are by default enabled.
20932110
2094-
=for apidoc vwarner
2095-
This is like C<L</warner>>, but C<args> are an encapsulated argument list.
2096-
2097-
=for apidoc fatal_warner
2098-
2099-
Like L</warner> except that it acts as if fatal warnings are enabled
2100-
for the warning.
2101-
2102-
If called when there are pending compilation errors this function may
2103-
return.
2104-
2105-
This is currently used to generate "used only once" fatal warnings
2106-
since the COP where the name being reported is no longer the current
2107-
COP when the warning is generated and may be useful for similar cases.
2108-
2109-
C<err> must be one of the C<L</packWARN>>, C<packWARN2>, C<packWARN3>,
2110-
C<packWARN4> macros populated with the appropriate number of warning
2111-
categories.
2112-
2113-
=for apidoc vfatal_warner
2114-
2115-
This is like C<L</fatal_warner>> but C<args> are an encapsulated
2116-
argument list.
21172111
21182112
=cut
21192113
*/

0 commit comments

Comments
 (0)