Skip to content

Commit c2a9b45

Browse files
author
Aidan Lee
committed
Merge branch 'master' into faster-hxcpp-h
2 parents ddf922f + 70933dc commit c2a9b45

103 files changed

Lines changed: 3040 additions & 1212 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/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ name: main
22
on: [push, pull_request]
33

44
jobs:
5+
check-headers:
6+
name: Check headers
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: checkout
10+
uses: actions/checkout@v4
11+
12+
- name: Install pcre2grep
13+
run: sudo apt-get update && sudo apt-get install -y pcre2-utils
14+
15+
- run: |
16+
# macros in public headers must use the global namespace to qualify types
17+
! pcre2grep --buffer-size=1M --recursive --multiline --line-number --include='.*\.h$' \
18+
'#define\s+(?:.*\\\r?\n)*.*?\K(?<!:)\b(Enum|String|StringOffset|Array|ArrayClassID|Math|Math_obj|Void|null|Dynamic|hx::|cpp::)\b' \
19+
include
20+
name: Check public headers
21+
522
Windows32:
623
strategy:
724
fail-fast: false

.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,21 @@ jobs:
221221
run: haxe compile-cpp.hxml -D ${{ env.HXCPP_ARCH_FLAG }} -D no_http
222222
- name: run
223223
run: bin${{ inputs.sep }}cpp${{ inputs.sep }}TestMain-debug
224+
build_tool:
225+
runs-on: ${{ inputs.os }}
226+
name: build tool tests
227+
steps:
228+
- name: checkout
229+
uses: actions/checkout@v4
230+
- name: setup
231+
uses: ./.github/workflows/setup
232+
with:
233+
haxe: ${{ inputs.haxe }}
234+
- name: test c/cxx_standard attributes
235+
working-directory: test/cxx_standard
236+
shell: bash
237+
run: |
238+
for xml in *.xml; do
239+
haxelib run hxcpp $xml
240+
haxelib run hxcpp $xml clean
241+
done

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ hxcpp.n
2929

3030
.vscode
3131

32+
test/cxx_standard/main
33+
test/cxx_standard/main.hash
34+
test/cxx_standard/main.exe
35+
test/cxx_standard/main.exe.hash
36+
3237
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio
3338
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio
3439

docs/build_xml/Defines.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ Defines affecting how the code is compiled. These can be on the command line wh
3737
| *HXCPP_CHECK_POINTER* | Add null-pointer checks,even in release mode. |
3838
| *HXCPP_PROFILER* | Add profiler support |
3939
| *HXCPP_TELEMETRY* | Add telemetry support |
40-
| *HXCPP_CPP11* | Use c++11 features and link libraries |
41-
| *HXCPP_CPP17* | Use c++17 features and link libraries |
40+
| *HXCPP_C_STANDARD* | Set default C standard |
41+
| *HXCPP_CXX_STANDARD* | Set default C++ standard |
42+
| *HXCPP_OBJC_STANDARD* | Set default Objective-C standard |
43+
| *HXCPP_OBJCXX_STANDARD* | Set default Objective-C++ standard |
4244
| *exe_link* | Generate executable file (rather than dynamic library on android) |
4345
| *static_link* | Generate static library |
4446
| *dll_link* | Generate dynamic library |

docs/build_xml/Files.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ Files
22
------
33
The files node defines a group of files that all share the same attributes, including relative directory, default compiler flags and dependencies. The node can be used to define a set of header files on which other files can depend, or a set of source files to be compiled and included in a target.
44

5+
```xml
6+
<files id="foo" cxx_standard="14">
7+
<file name="foo.cpp"/>
8+
<file name="bar.c"/>
9+
</files>
10+
```
11+
12+
#### Attributes
13+
14+
+ `c_standard` = Default C standard for the file group
15+
+ `cxx_standard` = Default C++ standard for the file group
16+
+ `objc_standard` = Default Objective-C standard for the file group
17+
+ `objcxx_standard` = Default Objective-C++ standard for the file group
18+
#### Nodes
519
- *depend* - Declare that all files in the group depend on another file or another file group.
620
```xml
721
<depend name="filename" />
@@ -80,13 +94,17 @@ The files node defines a group of files that all share the same attributes, incl
8094

8195
- *file* - Add file to group, with optional attributes
8296
```xml
83-
<file name="filename" tags="tag,tag1" filterout="define" embedName="embed" >
97+
<file name="filename" tags="tag,tag1" filterout="define" embedName="embed" cxx_standard="17">
8498
<depend name="filename1" />
8599
<depend name="filename2" />
86100
</file>
87101
```
88102
+ name = name of file - may be absolute or relative to files.dir
89103
+ tags = optional override of group tags. See [Tags.md](Tags.md).
104+
+ `c_standard` = C standard for the file
105+
+ `cxx_standard` = C++ standard for the file
106+
+ `objc_standard` = Objective-C standard for the file
107+
+ `objcxx_standard` = Objective-C++ standard for the file
90108
+ filterout = allows files to be skipped at compile-time if the named define exists.
91109
This is useful when the define is set sometime after the file list is parsed.
92110
+ depend name = filename of additional dependency

include/Array.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ cpp::VirtualArray Array_obj<ELEM_>::map(MappingFunc inFunc)
13041304

13051305
#ifdef HXCPP_VISIT_ALLOCS
13061306
#define ARRAY_VISIT_FUNC \
1307-
void __Visit(hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
1307+
void __Visit(::hx::VisitContext *__inCtx) { HX_VISIT_MEMBER(mThis); }
13081308
#else
13091309
#define ARRAY_VISIT_FUNC
13101310
#endif
@@ -1339,8 +1339,8 @@ namespace hx
13391339
{ \
13401340
struct _hx_array_##name final : public ::hx::AutoCallable_obj<value(args_list)> \
13411341
{ \
1342-
Array<ELEM_> mThis; \
1343-
_hx_array_##name(Array<ELEM_> inThis) : mThis(inThis) \
1342+
::Array<ELEM_> mThis; \
1343+
_hx_array_##name(::Array<ELEM_> inThis) : mThis(inThis) \
13441344
{ \
13451345
HX_OBJ_WB_NEW_MARKED_OBJECT(this); \
13461346
} \
@@ -1349,13 +1349,13 @@ namespace hx
13491349
ret mThis->name(args_call); \
13501350
} \
13511351
void *__GetHandle() const override { return mThis.GetPtr(); } \
1352-
void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
1352+
void __Mark(::hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
13531353
ARRAY_VISIT_FUNC \
13541354
int __Compare(const ::hx::Object* inRhs) const override \
13551355
{ \
13561356
auto casted = dynamic_cast<const _hx_array_##name *>(inRhs); \
13571357
if (!casted) return 1; \
1358-
if (!hx::IsPointerEq(mThis, casted->mThis)) return -1; \
1358+
if (!::hx::IsPointerEq(mThis, casted->mThis)) return -1; \
13591359
return 0; \
13601360
} \
13611361
}; \
@@ -1431,31 +1431,31 @@ template<class ELEM_>
14311431
hx::Val Array_obj<ELEM_>::__Field(const String& inString, hx::PropertyAccess inCallProp)
14321432
{
14331433
#define ARRAY_RUN_FUNC(ret,func,dynamic_arg_list,arg_list) \
1434-
Dynamic __run(dynamic_arg_list) \
1434+
::Dynamic __run(dynamic_arg_list) \
14351435
{ \
1436-
ret mThis->__##func(arg_list); return Dynamic(); \
1436+
ret mThis->__##func(arg_list); return ::Dynamic(); \
14371437
}
14381438

14391439
#define DEFINE_ARRAY_FUNC(ret,func,array_list,run_func,ARG_C) \
1440-
struct Reflective_##func : public hx::Object \
1440+
struct Reflective_##func : public ::hx::Object \
14411441
{ \
1442-
HX_IS_INSTANCE_OF enum { _hx_ClassId = hx::clsIdClosure }; \
1442+
HX_IS_INSTANCE_OF enum { _hx_ClassId = ::hx::clsIdClosure }; \
14431443
bool __IsFunction() const { return true; } \
1444-
Array_obj<ELEM_> *mThis; \
1445-
Reflective_##func(Array_obj<ELEM_> *inThis) : mThis(inThis) { } \
1446-
String toString() const{ return HX_CSTRING(#func) ; } \
1447-
String __ToString() const{ return HX_CSTRING(#func) ; } \
1444+
::Array_obj<ELEM_> *mThis; \
1445+
Reflective_##func(::Array_obj<ELEM_> *inThis) : mThis(inThis) { } \
1446+
::String toString() const{ return HX_CSTRING(#func) ; } \
1447+
::String __ToString() const{ return HX_CSTRING(#func) ; } \
14481448
int __GetType() const { return vtFunction; } \
14491449
void *__GetHandle() const { return mThis; } \
14501450
int __ArgCount() const { return ARG_C; } \
1451-
void __Mark(hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
1451+
void __Mark(::hx::MarkContext *__inCtx) { HX_MARK_MEMBER(mThis); } \
14521452
ARRAY_VISIT_FUNC \
1453-
Dynamic __Run(const Array<Dynamic> &inArgs) \
1453+
::Dynamic __Run(const ::Array<::Dynamic> &inArgs) \
14541454
{ \
1455-
ret mThis->__##func(array_list); return Dynamic(); \
1455+
ret mThis->__##func(array_list); return ::Dynamic(); \
14561456
} \
14571457
run_func \
1458-
int __Compare(const hx::Object *inRHS) const \
1458+
int __Compare(const ::hx::Object *inRHS) const \
14591459
{ \
14601460
if (!dynamic_cast<const Reflective_##func *>(inRHS)) return -1; \
14611461
return (mThis==inRHS->__GetHandle() ? 0 : -1); \

0 commit comments

Comments
 (0)