PATCH: [perl #111338] Warnings in utf8 subcategories do nothing in isolation

This was the result of assuming that these would not be on unless
the main category was also on.
This commit is contained in:
Karl Williamson 2012-03-05 10:34:05 -07:00
parent 65c512c351
commit a099aed4f4
3 changed files with 2 additions and 5 deletions

2
doio.c
View File

@ -1225,7 +1225,7 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp)
tmpbuf = bytes_to_utf8((const U8*) tmps, &len);
tmps = (char *) tmpbuf;
}
else if (ckWARN_d(WARN_UTF8)) {
else if (ckWARN4_d(WARN_UTF8, WARN_SURROGATE, WARN_NON_UNICODE, WARN_NONCHAR)) {
(void) check_utf8_print((const U8*) tmps, len);
}
}

View File

@ -349,7 +349,6 @@ EXPECT
Unicode surrogate U+D800 is illegal in UTF-8 at - line 6.
Unicode non-character U+FFFF is illegal for open interchange at - line 7.
########
# TODO
# NAME C<use warnings "nonchar"> works in isolation
require "../test.pl";
use warnings 'nonchar';
@ -360,7 +359,6 @@ close $fh;
EXPECT
Unicode non-character U+FFFF is illegal for open interchange at - line 5.
########
# TODO
# NAME C<use warnings "surrogate"> works in isolation
require "../test.pl";
use warnings 'surrogate';
@ -371,7 +369,6 @@ close $fh;
EXPECT
Unicode surrogate U+D800 is illegal in UTF-8 at - line 5.
########
# TODO
# NAME C<use warnings "non_unicode"> works in isolation
require "../test.pl";
use warnings 'non_unicode';

2
utf8.c
View File

@ -137,7 +137,7 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
{
PERL_ARGS_ASSERT_UVUNI_TO_UTF8_FLAGS;
if (ckWARN_d(WARN_UTF8)) {
if (ckWARN4_d(WARN_UTF8, WARN_SURROGATE, WARN_NON_UNICODE, WARN_NONCHAR)) {
if (UNICODE_IS_SURROGATE(uv)) {
if (flags & UNICODE_WARN_SURROGATE) {
Perl_ck_warner_d(aTHX_ packWARN(WARN_SURROGATE),