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 88#include < iterator>
99#include < format>
1010#include < span>
11+ #include < string.h>
1112#include " ecsact/runtime/common.h"
1213#include " ecsact/codegen/plugin.h"
1314
@@ -41,20 +42,24 @@ namespace ecsact {
4142 * }
4243 * ```
4344 */
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
5051) -> void {
5152 if (out_filenames != nullptr ) {
5253 for (auto i = 0 ; max_filenames > i; ++i) {
5354 if (i >= std::size (filenames)) {
5455 break ;
5556 }
5657 auto filename = std::data (filenames) + i;
58+ #if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
5759 strcpy_s (out_filenames[i], max_filename_length, filename->c_str ());
60+ #else
61+ strcpy (out_filenames[i], filename->c_str ());
62+ #endif
5863 }
5964 }
6065
Original file line number Diff line number Diff line change 1- load ("@rules_cc//cc:defs.bzl" , "cc_binary" )
21load ("@bazel_skylib//rules:build_test.bzl" , "build_test" )
3- load ("@ecsact_codegen//bazel:copts.bzl" , "copts" )
42load ("@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" )
55
66cc_binary (
77 name = "mock_plugin_bin" ,
8+ srcs = ["mock_plugin.cc" ],
89 linkshared = True ,
910 copts = copts ,
1011 deps = [
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module(name = "ecsact_codegen_test")
22
33bazel_dep (name = "rules_cc" , version = "0.0.9" )
44bazel_dep (name = "bazel_skylib" , version = "1.5.0" )
5+
56bazel_dep (name = "toolchains_llvm" , version = "1.0.0" , dev_dependency = True )
67bazel_dep (name = "hedron_compile_commands" , dev_dependency = True )
78
Original file line number Diff line number Diff line change 1+ #include < array>
2+ #include < string>
13#include " ecsact/codegen/plugin.h"
24#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