File tree Expand file tree Collapse file tree 4 files changed +50
-8
lines changed Expand file tree Collapse file tree 4 files changed +50
-8
lines changed Original file line number Diff line number Diff line change 8
8
#include < iterator>
9
9
#include < format>
10
10
#include < span>
11
+ #include < string.h>
11
12
#include " ecsact/runtime/common.h"
12
13
#include " ecsact/codegen/plugin.h"
13
14
@@ -41,20 +42,24 @@ namespace ecsact {
41
42
* }
42
43
* ```
43
44
*/
44
- inline auto set_codegen_plugin_output_filenames (
45
- const auto & filenames,
46
- char * const * out_filenames,
47
- int32_t max_filenames,
48
- int32_t max_filename_length,
49
- int32_t * out_filenames_length
45
+ auto set_codegen_plugin_output_filenames (
46
+ const auto & filenames,
47
+ char * const * out_filenames,
48
+ int32_t max_filenames,
49
+ [[maybe_unused]] int32_t max_filename_length,
50
+ int32_t * out_filenames_length
50
51
) -> void {
51
52
if (out_filenames != nullptr ) {
52
53
for (auto i = 0 ; max_filenames > i; ++i) {
53
54
if (i >= std::size (filenames)) {
54
55
break ;
55
56
}
56
57
auto filename = std::data (filenames) + i;
58
+ #if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
57
59
strcpy_s (out_filenames[i], max_filename_length, filename->c_str ());
60
+ #else
61
+ strcpy (out_filenames[i], filename->c_str ());
62
+ #endif
58
63
}
59
64
}
60
65
Original file line number Diff line number Diff line change 1
- load ("@rules_cc//cc:defs.bzl" , "cc_binary" )
2
1
load ("@bazel_skylib//rules:build_test.bzl" , "build_test" )
3
- load ("@ecsact_codegen//bazel:copts.bzl" , "copts" )
4
2
load ("@ecsact_codegen//:codegen_plugin.bzl" , "ecsact_codegen_plugin" )
3
+ load ("@ecsact_codegen//bazel:copts.bzl" , "copts" )
4
+ load ("@rules_cc//cc:defs.bzl" , "cc_binary" )
5
5
6
6
cc_binary (
7
7
name = "mock_plugin_bin" ,
8
+ srcs = ["mock_plugin.cc" ],
8
9
linkshared = True ,
9
10
copts = copts ,
10
11
deps = [
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module(name = "ecsact_codegen_test")
2
2
3
3
bazel_dep (name = "rules_cc" , version = "0.0.9" )
4
4
bazel_dep (name = "bazel_skylib" , version = "1.5.0" )
5
+
5
6
bazel_dep (name = "toolchains_llvm" , version = "1.0.0" , dev_dependency = True )
6
7
bazel_dep (name = "hedron_compile_commands" , dev_dependency = True )
7
8
Original file line number Diff line number Diff line change
1
+ #include < array>
2
+ #include < string>
1
3
#include " ecsact/codegen/plugin.h"
2
4
#include " ecsact/codegen/plugin.hh"
5
+
6
+ using namespace std ::string_literals;
7
+
8
+ auto ecsact_codegen_output_filenames ( //
9
+ [[maybe_unused]] ecsact_package_id package_id,
10
+ char * const * out_filenames,
11
+ int32_t max_filenames,
12
+ int32_t max_filename_length,
13
+ int32_t * out_filenames_length
14
+ ) -> void {
15
+ ecsact::set_codegen_plugin_output_filenames (
16
+ std::array{
17
+ " test.a" s,
18
+ " test.b" s,
19
+ " test.c" s,
20
+ },
21
+ out_filenames,
22
+ max_filenames,
23
+ max_filename_length,
24
+ out_filenames_length
25
+ );
26
+ }
27
+
28
+ auto ecsact_codegen_plugin_name () -> const char* {
29
+ return " mock" ;
30
+ }
31
+
32
+ auto ecsact_codegen_plugin ( //
33
+ [[maybe_unused]] ecsact_package_id package_id,
34
+ [[maybe_unused]] ecsact_codegen_write_fn_t write_fn,
35
+ [[maybe_unused]] ecsact_codegen_report_fn_t report_fn
36
+ ) -> void {
37
+ }
You can’t perform that action at this time.
0 commit comments