New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] silence MSVC warnings for NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8 #15514
Labels
Comments
From @bulk88Created by @bulk88See attached patch. This is a 5.24 backport since 5.24.0 has lots of Perl Info
|
From @bulk880001-silence-MSVC-warnings-for-NATIVE_UTF8_TO_I8-I8_TO_NA.patchFrom 8f88d927d7336ec07b36882bdc4bba6407cf3bc8 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Sun, 14 Aug 2016 11:01:00 -0400
Subject: [PATCH] silence MSVC warnings for
NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8
The result of I8_TO_NATIVE_UTF8 has to be U8 casted for the MSVC specific
PERL_SMALL_MACRO_BUFFER option just like it is for newer CCs that dont
have a small CPP buffer. Commit 1a3756de64/#127426 did add U8 casts to
NATIVE_TO_LATIN1/LATIN1_TO_NATIVE but missed
NATIVE_UTF8_TO_I8/I8_TO_NATIVE_UTF8. This commit fixes that.
One example of the C4244 warning is VC6 thinks 0xFF & (0xFE << 6) in
UTF_START_MARK could be bigger than 0xff (a char), fixes
..\inline.h(247) : warning C4244: '=' : conversion from 'long ' to
'unsigned char ', possible loss of data
Also fixes
..\utf8.c(146) : warning C4244: '=' : conversion from 'UV' to 'U8',
possible loss of data
and alot more warnings in utf8.c
---
utf8.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/utf8.h b/utf8.h
index bc5b8c9..ee2d97e 100644
--- a/utf8.h
+++ b/utf8.h
@@ -156,8 +156,8 @@ END_EXTERN_C
* rarely do we need to distinguish them. The term "NATIVE_UTF8" applies to
* whichever one is applicable on the current platform */
#ifdef PERL_SMALL_MACRO_BUFFER
-#define NATIVE_UTF8_TO_I8(ch) (ch)
-#define I8_TO_NATIVE_UTF8(ch) (ch)
+#define NATIVE_UTF8_TO_I8(ch) ((U8) (ch))
+#define I8_TO_NATIVE_UTF8(ch) ((U8) (ch))
#else
#define NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
#define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
--
1.7.9.msysgit.0
|
From @khwilliamsonThanks, applied as 1d4ea28 |
The RT System itself - Status changed from 'new' to 'open' |
@khwilliamson - Status changed from 'open' to 'resolved' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Migrated from rt.perl.org#128929 (status was 'resolved')
Searchable as RT128929$
The text was updated successfully, but these errors were encountered: