Skip to content

Commit 1cf03e5

Browse files
committed
Merge remote-tracking branch 'upstream' into fix/override-warnings
2 parents a8e83bb + e3d16f0 commit 1cf03e5

134 files changed

Lines changed: 3597 additions & 1465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ jobs:
135135
uses: ncipollo/release-action@v1
136136
with:
137137
tag: v${{ env.hxcpp_release }}
138-
commit: ${{ github.head_ref }}
138+
commit: ${{ github.ref }}
139139
name: Release ${{ env.hxcpp_release }}
140140
draft: false
141141
prerelease: false
142-
artifacts: ./hxcpp-${{ env.hxcpp_release }}.zip
142+
artifacts: ./hxcpp-${{ env.hxcpp_release }}.zip

.github/workflows/test.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,30 @@ jobs:
196196
steps:
197197
- name: checkout
198198
uses: actions/checkout@v4
199+
- name: setup
200+
uses: ./.github/workflows/setup
201+
with:
202+
haxe: ${{ inputs.haxe }}
203+
- name: Get Haxe commit SHA
204+
if: inputs.haxe == 'latest'
205+
id: haxe_sha
206+
shell: bash
207+
working-directory:
208+
${{github.workspace}}
209+
env:
210+
GH_TOKEN: ${{ github.token }}
211+
run: |
212+
version=$(haxe --version)
213+
short_sha=${version##*+}
214+
full_sha=$(gh api repos/HaxeFoundation/haxe/commits/$short_sha --jq '.sha')
215+
echo "Haxe version: $version"
216+
echo "sha=$full_sha" >> "$GITHUB_OUTPUT"
217+
echo "Commit SHA: $short_sha, Full SHA: $full_sha"
199218
- name: checkout haxe (latest)
200219
if: inputs.haxe == 'latest'
201220
uses: actions/checkout@v4
202221
with:
222+
ref: ${{ steps.haxe_sha.outputs.sha }}
203223
repository: HaxeFoundation/haxe
204224
path: haxe
205225
- name: checkout haxe (stable)
@@ -209,10 +229,6 @@ jobs:
209229
repository: HaxeFoundation/haxe
210230
path: haxe
211231
ref: ${{ inputs.haxe }}
212-
- name: setup
213-
uses: ./.github/workflows/setup
214-
with:
215-
haxe: ${{ inputs.haxe }}
216232
- name: install haxe libs
217233
run: haxelib install compile-cpp.hxml --always
218234
# haxe 4 tests don't build with latest utest

include/Dynamic.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
168168
bool operator op (const ::String &inRHS) const { return mPtr && ((::String)(*this) op inRHS); } \
169169
bool operator op (double inRHS) const { return IsNumeric() && ((double)(*this) op inRHS); } \
170170
bool operator op (::cpp::Int64 inRHS) const { return IsNumeric() && ((::cpp::Int64)(*this) op inRHS); } \
171-
bool operator op (::cpp::UInt64 inRHS) const { return IsNumeric() && ((::cpp::Int64)(*this) op inRHS); } \
171+
bool operator op (::cpp::UInt64 inRHS) const { return IsNumeric() && ((::cpp::UInt64)(*this) op inRHS); } \
172172
bool operator op (float inRHS) const { return IsNumeric() && ((double)(*this) op inRHS); } \
173173
bool operator op (int inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
174174
bool operator op (unsigned int inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
@@ -183,7 +183,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
183183
bool operator != (const String &inRHS) const { return !mPtr || ((String)(*this) != inRHS); }
184184
bool operator != (double inRHS) const { return !IsNumeric() || ((double)(*this) != inRHS); }
185185
bool operator != (cpp::Int64 inRHS) const { return !IsNumeric() || ((cpp::Int64)(*this) != inRHS); }
186-
bool operator != (cpp::UInt64 inRHS) const { return !IsNumeric() || ((cpp::Int64)(*this) != inRHS); }
186+
bool operator != (cpp::UInt64 inRHS) const { return !IsNumeric() || ((cpp::UInt64)(*this) != inRHS); }
187187
bool operator != (float inRHS) const { return !IsNumeric() || ((double)(*this) != inRHS); }
188188
bool operator != (int inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
189189
bool operator != (unsigned int inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
@@ -381,9 +381,9 @@ inline int Dynamic::Cast<int>() const { return mPtr ? mPtr->__ToInt() : 0; }
381381
template<>
382382
inline bool Dynamic::Cast<bool>() const { return mPtr ? mPtr->__ToInt() : 0; }
383383
template<>
384-
inline double Dynamic::Cast<double>() const { return mPtr ? mPtr->__ToDouble() : 0; }
384+
inline double Dynamic::Cast<double>() const { return mPtr ? mPtr->__ToDouble() : 0.0; }
385385
template<>
386-
inline float Dynamic::Cast<float>() const { return mPtr ? mPtr->__ToDouble() : 0; }
386+
inline float Dynamic::Cast<float>() const { return (float)(mPtr ? mPtr->__ToDouble() : 0.0f); }
387387
template<>
388388
inline String Dynamic::Cast<String>() const { return mPtr ? mPtr->toString() : String(null()); }
389389

@@ -466,8 +466,8 @@ COMPARE_DYNAMIC_OP( > )
466466

467467

468468
#define ARITH_DYNAMIC( op ) \
469-
inline double operator op (const ::cpp::Int64 &inLHS,const ::Dynamic &inRHS) { return inLHS op (::cpp::Int64)inRHS;} \
470-
inline double operator op (const ::cpp::UInt64 &inLHS,const ::Dynamic &inRHS) { return inLHS op (::cpp::UInt64)inRHS;} \
469+
inline double operator op (const ::cpp::Int64 &inLHS,const ::Dynamic &inRHS) { return (double)( inLHS op (::cpp::Int64)inRHS );} \
470+
inline double operator op (const ::cpp::UInt64 &inLHS,const ::Dynamic &inRHS) { return (double)( inLHS op (::cpp::UInt64)inRHS );} \
471471
inline double operator op (const double &inLHS,const ::Dynamic &inRHS) { return inLHS op (double)inRHS;} \
472472
inline double operator op (const float &inLHS,const ::Dynamic &inRHS) { return inLHS op (double)inRHS;} \
473473
inline double operator op (const int &inLHS,const ::Dynamic &inRHS) { return inLHS op (double)inRHS; } \

include/cpp/Pointer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class Pointer_obj
503503
}
504504

505505
template<typename T>
506-
inline static AutoCast ofArray(::Array<T> array) { return AutoCast(&array[0]); }
506+
inline static AutoCast ofArray(::Array<T> array) { return AutoCast(array->Pointer()); }
507507
inline static AutoCast ofArray(Dynamic inVal)
508508
{
509509
if (inVal==null() || !inVal->__IsArray())

include/cpp/Variant.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace cpp
102102
inline operator double() const { return asDouble(); }
103103
inline operator int() const { return asInt(); }
104104
inline operator bool() const { return asInt(); }
105-
inline operator float () const { return asDouble(); }
105+
inline operator float () const { return (float)asDouble(); }
106106
inline operator unsigned int () const { return asInt(); }
107107
inline operator short () const { return asInt(); }
108108
inline operator unsigned short () const { return asInt(); }
@@ -345,7 +345,7 @@ namespace cpp
345345

346346
switch(type)
347347
{
348-
case typeDouble: return valDouble;
348+
case typeDouble: return (int)valDouble;
349349
case typeInt64: return (int)valInt64;
350350
case typeBool: return valBool;
351351
case typeObject: return valObject ? valObject->__ToInt() : 0;
@@ -363,7 +363,7 @@ namespace cpp
363363

364364
switch(type)
365365
{
366-
case typeDouble: return valDouble;
366+
case typeDouble: return (cpp::Int64)valDouble;
367367
case typeInt: return valInt;
368368
case typeBool: return valBool;
369369
case typeObject: return valObject ? valObject->__ToInt64() : 0;
@@ -381,7 +381,7 @@ namespace cpp
381381
else if (type==typeBool)
382382
return valBool ? 1.0 : 0.0;
383383
else if (type==typeInt64)
384-
return valInt64;
384+
return (double)valInt64;
385385
else if (type==typeObject)
386386
return valObject ? valObject->__ToDouble() : 0.0;
387387
return 0.0;

include/cpp/encoding/Utf16.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace cpp
99
static bool isEncoded(const String& string);
1010

1111
static int getByteCount(const null&);
12-
static int getByteCount(const char32_t& codepoint);
12+
static int getByteCount(char32_t codepoint);
1313
static int64_t getByteCount(const String& string);
1414

1515
static int getCharCount(const null&);
16-
static int getCharCount(const char32_t& codepoint);
16+
static int getCharCount(char32_t codepoint);
1717
static int64_t getCharCount(const String& string);
1818

1919
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
20-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
20+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
2121
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
2222

2323
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);

include/cpp/encoding/Utf8.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ namespace cpp
77
struct Utf8 final
88
{
99
static int getByteCount(const null&);
10-
static int getByteCount(const char32_t& codepoint);
10+
static int getByteCount(char32_t codepoint);
1111
static int64_t getByteCount(const String& string);
1212

1313
static int getCharCount(const null&);
14-
static int getCharCount(const char32_t& codepoint);
14+
static int getCharCount(char32_t codepoint);
1515
static int64_t getCharCount(const String& string);
1616

1717
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
18-
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
18+
static int encode(char32_t codepoint, const cpp::marshal::View<uint8_t>& buffer);
1919
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
20+
static Array<uint8_t> encode(const String& string);
2021

2122
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);
2223
static String decode(const cpp::marshal::View<uint8_t>& buffer);

include/cpp/marshal/Marshal.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ inline void cpp::marshal::Marshal::writeLittleEndianUInt32(const View<uint8_t>&
414414
inline void cpp::marshal::Marshal::writeLittleEndianUInt64(const View<uint8_t>& view, const uint64_t& value)
415415
{
416416
#ifdef HXCPP_BIG_ENDIAN
417-
writeUInt16(view, reverse(value));
417+
writeUInt64(view, reverse(value));
418418
#else
419-
writeUInt16(view, value);
419+
writeUInt64(view, value);
420420
#endif
421421
}
422422

@@ -496,9 +496,9 @@ inline void cpp::marshal::Marshal::writeBigEndianUInt32(const View<uint8_t>& vie
496496
inline void cpp::marshal::Marshal::writeBigEndianUInt64(const View<uint8_t>& view, const uint64_t& value)
497497
{
498498
#ifndef HXCPP_BIG_ENDIAN
499-
writeUInt16(view, reverse(value));
499+
writeUInt64(view, reverse(value));
500500
#else
501-
writeUInt16(view, value);
501+
writeUInt64(view, value);
502502
#endif
503503
}
504504

include/hx/Functions.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ namespace hx
157157
return wrapped.GetPtr();
158158
}
159159

160+
std::type_index callableId() const override
161+
{
162+
return wrapped->callableId();
163+
}
164+
160165
inline void __Mark(hx::MarkContext* __inCtx) override
161166
{
162167
HX_MARK_MEMBER(wrapped);
@@ -337,6 +342,11 @@ namespace hx
337342
return wrapped.GetPtr();
338343
}
339344

345+
std::type_index callableId() const override
346+
{
347+
return wrapped->callableId();
348+
}
349+
340350
inline void __Mark(hx::MarkContext* __inCtx) override
341351
{
342352
HX_MARK_MEMBER(wrapped);

include/hx/GC.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ namespace hx
329329

330330

331331

332-
class StackContext;
332+
struct StackContext;
333333

334334
EXTERN_FAST_TLS_DATA(StackContext, tlsStackContext);
335335

@@ -360,7 +360,7 @@ class ImmixAllocator
360360

361361

362362

363-
// These allocate the function using the garbage-colleced malloc
363+
// These allocate the function using the garbage-collected malloc
364364
inline static void *alloc(ImmixAllocator *alloc, size_t inSize, bool inContainer, const char *inName )
365365
{
366366
#ifdef HXCPP_GC_NURSERY
@@ -406,7 +406,7 @@ class ImmixAllocator
406406
// Ensure odd alignment in 8 bytes
407407
start += 4 - (start & 4);
408408
#endif
409-
int end = start + sizeof(int) + inSize;
409+
int end = start + (int)(sizeof(int) + inSize);
410410

411411
if ( end <= alloc->spaceEnd )
412412
{
@@ -420,11 +420,11 @@ class ImmixAllocator
420420

421421
if (inContainer)
422422
*buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
423-
(inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
423+
((int)inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
424424
hx::gMarkIDWithContainer;
425425
else
426426
*buffer++ = (( (end+(IMMIX_LINE_LEN-1))>>IMMIX_LINE_BITS) -startRow) |
427-
(inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
427+
((int)inSize<<IMMIX_ALLOC_SIZE_SHIFT) |
428428
hx::gMarkID;
429429

430430
#if defined(HXCPP_GC_CHECK_POINTER) && defined(HXCPP_GC_DEBUG_ALWAYS_MOVE)
@@ -439,7 +439,7 @@ class ImmixAllocator
439439
}
440440

441441
// Fall back to external method
442-
void *result = alloc->CallAlloc(inSize, inContainer ? IMMIX_ALLOC_IS_CONTAINER : 0);
442+
void *result = alloc->CallAlloc((int)inSize, inContainer ? IMMIX_ALLOC_IS_CONTAINER : 0);
443443

444444
#ifdef HXCPP_TELEMETRY
445445
__hxt_gc_new((hx::StackContext *)alloc,result, inSize, inName);

0 commit comments

Comments
 (0)