Skip to content

Commit 645f5a6

Browse files
authored
ci(build): use Ninja as CMake generator explicit (#158)
1 parent 1bbd650 commit 645f5a6

15 files changed

Lines changed: 314 additions & 277 deletions

File tree

.github/workflows/build.yml

Lines changed: 222 additions & 228 deletions
Large diffs are not rendered by default.

inkcpp/include/functional.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ class callback final : public callback_base
7272
static_cast<int>(type), static_cast<int>(new_val.type)
7373
);
7474
if constexpr (traits::arity == 2) {
75-
// inkAssert(!old_val.has_value() || old_val.value().type == type,
76-
// "Missmatch type for variable observers old value: expected optional<%i> got
77-
// optional<%i>", static_cast<int>(type), static_cast<int>(old_val.value().type));
75+
if (old_val.has_value() && old_val.value().type != type) {
76+
inkFail(
77+
"Missmatch type for variable observers old value: expected optional<%i> got "
78+
"optional<%i>",
79+
static_cast<int>(type), static_cast<int>(old_val.value().type)
80+
);
81+
}
7882
}
7983
};
8084
if constexpr (traits::arity > 0) {

inkcpp/include/globals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class globals_interface
2828
* @return nullopt if variable won't exist or type won't match
2929
*/
3030
template<typename T>
31-
optional<T> get(const char* name) const
31+
optional<T> get(const char* /*name*/) const
3232
{
3333
static_assert(internal::always_false<T>::value, "Requested Type is not supported");
3434
}
@@ -41,7 +41,7 @@ class globals_interface
4141
* @retval true on success
4242
*/
4343
template<typename T>
44-
bool set(const char* name, const T& val)
44+
bool set(const char* /*name*/, const T& /*val*/)
4545
{
4646
static_assert(internal::always_false<T>::value, "Requested Type is not supported");
4747
return false;

inkcpp/include/types.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ struct value {
129129

130130
/// @}
131131

132+
#ifdef __GNUCC__
133+
# pragma GCC diagnostic push
134+
# pragma GCC diagnostic ignored "-Wtautological-compare"
135+
#endif
132136
/** Get value to corresponding type
133137
* @tparam Ty #Type label of type to get
134138
* @attention behavior if undefined if Ty != value.type
@@ -138,6 +142,9 @@ struct value {
138142
{
139143
static_assert(Ty != Ty, "No value getter for the selected type");
140144
}
145+
#ifdef __GNUCC__
146+
# pragma GCC diagnostic pop
147+
#endif
141148
};
142149

143150
/** access a @ref ink::runtime::value::Type::Bool value */

inkcpp/operations.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class operation
6060
static constexpr bool enabled = false;
6161

6262
template<typename T>
63-
operation(const T& t)
63+
operation(const T& /*t*/)
6464
{
6565
}
6666

@@ -69,7 +69,10 @@ class operation
6969
* @param stack were the result(s) get pushed
7070
* @param vs array of values, first one = first argument etc
7171
*/
72-
void operator()(basic_eval_stack& stack, value* vs) { inkFail("operation not implemented!"); }
72+
void operator()(basic_eval_stack& /*stack*/, value* /*vs*/)
73+
{
74+
inkFail("operation not implemented!");
75+
}
7376
};
7477
} // namespace ink::runtime::internal
7578

inkcpp/output.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void basic_stream::append(const value* in, unsigned int length)
120120
}
121121

122122
template<typename T>
123-
inline void write_char(T& output, char c)
123+
inline void write_char(T& /*output*/, char /*c*/)
124124
{
125125
static_assert(always_false<T>::value, "Invalid output type");
126126
}

inkcpp/string_operations.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ namespace casting
3131
const char* get() const { return _str; }
3232

3333
private:
34-
const value& _val;
35-
const char* _str;
36-
char _data[512]; // TODO define central
34+
const char* _str;
35+
char _data[512]; // TODO define central
3736
};
3837

3938
// constructor for string_cast class
4039
string_cast::string_cast(const value& val)
41-
: _val{val}
42-
, _str{nullptr}
40+
: _str{nullptr}
4341
{
4442
if (val.type() == value_type::string) {
4543
// reference string if value is already a string

inkcpp/string_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace ink::runtime::internal
1717
class string_table final : public snapshot_interface
1818
{
1919
public:
20-
virtual ~string_table();
20+
~string_table();
2121

2222
// Create a dynamic string of a particular length
2323
char* create(size_t length);

inkcpp/value.h

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,27 @@ class value : public snapshot_interface
134134
bool set(const ink::runtime::value& val);
135135
ink::runtime::value to_interface_value(list_table&) const;
136136

137+
#ifdef __GNUCC__
138+
# pragma GCC diagnostic push
139+
# pragma GCC diagnostic ignored "-Wtautological-compare"
140+
#endif
137141
/// get value of the type (if possible)
138142
template<value_type ty>
139143
typename ret<ty>::type get() const
140144
{
141145
static_assert(ty != ty, "No getter for this type defined!");
142146
}
143147

148+
#ifdef __GNUCC__
149+
# pragma GCC diagnostic pop
150+
#endif
151+
144152
/// check if value evaluates to true
145153
bool truthy(const list_table& lists) const;
146154

147155
/// set value of type (if possible)
148156
template<value_type ty, typename... Args>
149-
constexpr value& set(Args... args)
157+
constexpr value& set(Args...)
150158
{
151159
static_assert(sizeof...(Args) != sizeof...(Args), "No setter for this type defined!");
152160
return *this;
@@ -192,30 +200,37 @@ class value : public snapshot_interface
192200
}
193201

194202
/// actual storage
203+
struct value_jump {
204+
uint32_t jump;
205+
uint32_t thread_id;
206+
};
207+
208+
struct value_frame {
209+
uint32_t addr;
210+
bool eval; // was eval mode active in frame above
211+
};
212+
213+
struct value_pointer {
214+
hash_t name;
215+
int ci;
216+
};
217+
195218
union {
219+
196220
bool bool_value;
197221
int32_t int32_value;
198222
string_type string_value;
199223
uint32_t uint32_value;
200224
float float_value;
201225

202-
struct {
203-
uint32_t jump;
204-
uint32_t thread_id;
205-
} jump;
226+
value_jump jump;
206227

207228
list_table::list list_value;
208229
list_flag list_flag_value;
209230

210-
struct {
211-
uint32_t addr;
212-
bool eval; // was eval mode active in frame above
213-
} frame_value;
231+
value_frame frame_value;
214232

215-
struct {
216-
hash_t name;
217-
int ci;
218-
} pointer;
233+
value_pointer pointer;
219234
};
220235

221236
static constexpr size_t max_value_size = sizeof_largest_type<

inkcpp_c/tests/Globals.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include <string.h>
22
#include <math.h>
3-
#include <stdlib.h>
4-
#include <stdio.h>
53

64
#include <inkcpp.h>
75

@@ -12,7 +10,7 @@ HInkStory* story = NULL;
1210
HInkGlobals* store = NULL;
1311
HInkRunner* thread = NULL;
1412

15-
void setup()
13+
void setup(void)
1614
{
1715
if (! story) {
1816
story = ink_story_from_file(INK_TEST_RESOURCE_DIR "GlobalStory.bin");
@@ -27,7 +25,7 @@ void setup()
2725
thread = ink_story_new_runner(story, store);
2826
}
2927

30-
int main()
28+
int main(void)
3129
{
3230
//====== Just reading Globals =====
3331
setup();
@@ -57,7 +55,7 @@ int main()
5755
val.int32_v = 30;
5856
assert(ink_globals_set(store, "age", val));
5957

60-
// set value of 'friendl_name_of_player'
58+
// set value of 'friendly_name_of_player'
6159
val.type = ValueTypeString;
6260
val.string_v = "Freddy";
6361
assert(ink_globals_set(store, "friendly_name_of_player", val));

0 commit comments

Comments
 (0)