1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-24 01:25:50 +01:00

Fossil/Skagen hybrids: patch jerryscript for gcc 12+ in watchface build script

This commit is contained in:
Kevin MacMartin 2023-06-15 21:12:21 -04:00
parent 8f5bbec881
commit ecb71a6dc5
2 changed files with 37 additions and 0 deletions

View File

@ -1,5 +1,7 @@
#!/bin/bash
pushd jerryscript
gcc_version="$(gcc -v 2>&1 | grep -oe '^gcc version [0-9][0-9\.]*[0-9]' | sed 's|^.* ||;s|\..*||')"
(( gcc_version > 11 )) && git apply ../patches/jerryscript-gcc-12-build-fix.patch
python3 tools/build.py --jerry-cmdline-snapshot ON
popd
pushd fossil-hr-watchface

View File

@ -0,0 +1,35 @@
diff --git a/jerry-ext/handler/handler-register.c b/jerry-ext/handler/handler-register.c
index ad35d8c3..d808061f 100644
--- a/jerry-ext/handler/handler-register.c
+++ b/jerry-ext/handler/handler-register.c
@@ -63,7 +63,13 @@ jerryx_set_properties (const jerry_value_t target_object, /**< target object */
{
#define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result) { VALUE, IDX })
uint32_t idx = 0;
- for (; ((entries + idx) != NULL) && (entries[idx].name != NULL); idx++)
+
+ if (entries == NULL)
+ {
+ return JERRYX_SET_PROPERTIES_RESULT (jerry_create_undefined (), 0);
+ }
+
+ for (; (entries[idx].name != NULL); idx++)
{
const jerryx_property_entry *entry = &entries[idx];
@@ -99,9 +105,12 @@ void
jerryx_release_property_entry (const jerryx_property_entry entries[], /**< list of property entries */
const jerryx_register_result register_result) /**< previous result of registration */
{
- for (uint32_t idx = register_result.registered;
- ((entries + idx) != NULL) && (entries[idx].name != NULL);
- idx++)
+ if (entries == NULL)
+ {
+ return;
+ }
+
+ for (uint32_t idx = register_result.registered; entries[idx].name != NULL; idx++)
{
jerry_release_value (entries[idx].value);
}