This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit e1eb1dc3e400daf1d654f0d045c6990a5c1ada6e
Author: Jens Geyer <[email protected]>
AuthorDate: Sat Mar 27 00:44:56 2021 +0100

    THRIFT-5381 possible collisions at VOID type with some 3rd-party libraries 
on Haxe cpp targets
    Client: hx
    Patch: Jens Geyer
---
 compiler/cpp/src/thrift/generate/t_haxe_generator.cc        | 2 +-
 lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx  | 2 +-
 lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx | 2 +-
 lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx    | 2 +-
 lib/haxe/src/org/apache/thrift/protocol/TType.hx            | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc 
b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index 9f8e946..bfeaf50 100644
--- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -1407,7 +1407,7 @@ std::string 
t_haxe_generator::get_haxe_type_string(t_type* type) {
   } else if (type->is_base_type()) {
     switch (((t_base_type*)type)->get_base()) {
     case t_base_type::TYPE_VOID:
-      return "TType.VOID";
+      return "TType.VOID_";
       break;
     case t_base_type::TYPE_STRING:
       return "TType.STRING";
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx 
b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
index 2cc254b..736a7dc 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
@@ -306,7 +306,7 @@ class TBinaryProtocol extends TProtocolImplBase implements 
TProtocol {
                switch (type)
                {
                        case TType.STOP: return 0;
-                       case TType.VOID: return 0;
+                       case TType.VOID_: return 0;
                        case TType.BOOL: return 1;
                        case TType.BYTE: return 1;
                        case TType.DOUBLE: return 8;
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx 
b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
index ae626b5..bf7b886 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
@@ -711,7 +711,7 @@ class TCompactProtocol extends TProtocolImplBase implements 
TProtocol {
                switch (type)
                {
                        case TType.STOP:    return 0;
-                       case TType.VOID:    return 0;
+                       case TType.VOID_:    return 0;
                        case TType.BOOL:   return 1;
                        case TType.DOUBLE: return 8;  // uses 
fixedLongToBytes() which always writes 8 bytes
                        case TType.BYTE: return 1;
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx 
b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
index 145eab9..2385ca8 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
@@ -782,7 +782,7 @@ class TJSONProtocol extends TProtocolImplBase implements 
TProtocol {
                switch (type)
                {
                        case TType.STOP: return 0;
-                       case TType.VOID: return 0;
+                       case TType.VOID_: return 0;
                        case TType.BOOL: return 1;  // written as int  
                        case TType.BYTE: return 1;
                        case TType.DOUBLE: return 1;
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx 
b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
index 6abbc96..964b26e 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
@@ -22,7 +22,7 @@ package org.apache.thrift.protocol;
 @:enum
 abstract TType(Int)  from Int to Int  {
     public static inline var STOP : Int   = 0;
-    public static inline var VOID : Int   = 1;
+    public static inline var VOID_ : Int  = 1;  // VOID produces collisions 
with cpp targets in some cases
     public static inline var BOOL : Int   = 2;
     public static inline var BYTE : Int   = 3;
     public static inline var DOUBLE : Int = 4;

Reply via email to