external/harfbuzz: Silence clang-cl -Werror,-Wmicrosoft-enum-value

The code in harfbuzz' src/hb_common.h apparently goes to some length to ensure
that any value of type hb_tag_t (aka unit32_t) can be transported as a value of
the hb_script_t enum type.  However, under MSVC any C (or non-fixed C++) enum
type has an underlying type of int, so _HB_SCRIPT_MAX_VALUE of value 0xFFFFFFFF
will cause a -Wmicrosoft-enum-value under clang-cl.  To not complicate things
further, acknowledge that converting between hb_tag_t (an unsigned integer type
with 32 value bits) and hb_script_t (a two's-complement signed integer type with
32 value bits) is well-defined under MSVC and drop _HB_SCRIPT_MAX_VALUE (which
appears to be an otherwise unused implementation detail) there.

Change-Id: Ic03dff64a9dd24683c45347fa78699708c269972
This commit is contained in:
Stephan Bergmann
2016-10-20 13:28:17 +02:00
parent 4fb9926ebc
commit a523610467
2 changed files with 13 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
external/harfbuzz/ubsan.patch \
external/harfbuzz/clang-cl.patch \
))
ifneq ($(ENABLE_RUNTIME_OPTIMIZATIONS),TRUE)

12
external/harfbuzz/clang-cl.patch vendored Executable file
View File

@@ -0,0 +1,12 @@
--- src/hb-common.h
+++ src/hb-common.h
@@ -331,7 +331,9 @@
*
* http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
*/
+#if !defined _MSC_VER /* avoid clang-cl -Wmicrosoft-enum-value */
_HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/
+#endif
_HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_script_t;