Skip to content

Commit

Permalink
Update clang-format
Browse files Browse the repository at this point in the history
Bump minimum clang-format version to 15 (the previously used 10 is not
in the ubuntu-22.04 repo)

Reformat several files

Re-enable format and strings CI checkers

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
  • Loading branch information
matetokodi committed Dec 5, 2023
1 parent ef4cb2b commit b08fbe9
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 31 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ jobs:
with:
python-version: '3.10'
- run: sudo apt update
# TODO: update checkers to current versions available in ubuntu 22.04
# - run: sudo apt install clang-format-10 python-serial
- run: sudo apt install pylint doxygen cppcheck
- run: sudo apt install pylint doxygen cppcheck clang-format-15
- run: $RUNNER --check-signed-off=gh-actions
if: ${{ always() }}
- run: $RUNNER --check-doxygen
if: ${{ always() }}
# - run: $RUNNER --check-format
# if: ${{ always() }}
- run: $RUNNER --check-format
if: ${{ always() }}
- run: $RUNNER --check-license
if: ${{ always() }}
# - run: $RUNNER --check-strings
# if: ${{ always() }}
- run: $RUNNER --check-strings
if: ${{ always() }}
- run: $RUNNER --check-pylint
if: ${{ always() }}
- run: $RUNNER --check-cppcheck
Expand Down
1 change: 0 additions & 1 deletion jerry-core/api/jerry-snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ typedef struct
bool class_found;
} snapshot_globals_t;


/**
* Write data into the specified buffer.
*
Expand Down
3 changes: 1 addition & 2 deletions jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ ecma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type,
typedef ecma_value_t (*ecma_builtin_helper_sort_compare_fn_t) (ecma_value_t lhs, /**< left value */
ecma_value_t rhs, /**< right value */
ecma_value_t compare_func, /**< compare function */
ecma_object_t *array_buffer_p /**< arrayBuffer */
);
ecma_object_t *array_buffer_p /**< arrayBuffer */);

ecma_value_t ecma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p,
uint32_t length,
Expand Down
5 changes: 2 additions & 3 deletions jerry-core/ecma/operations/ecma-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1850,9 +1850,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
prop_desc_p->value = property_ref.virtual_value;
}

prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED);
prop_desc_p->flags = (uint16_t) (
prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED
| (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions jerry-core/include/jerryscript-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ JERRY_C_API_BEGIN
/*
* Compiler-specific macros relevant for Microsoft Visual C/C++ Compiler.
*/
#define JERRY_ATTR_DEPRECATED __declspec(deprecated)
#define JERRY_ATTR_NOINLINE __declspec(noinline)
#define JERRY_ATTR_NORETURN __declspec(noreturn)
#define JERRY_ATTR_DEPRECATED __declspec (deprecated)
#define JERRY_ATTR_NOINLINE __declspec (noinline)
#define JERRY_ATTR_NORETURN __declspec (noreturn)

/*
* Microsoft Visual C/C++ Compiler doesn't support for VLA, using _alloca
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/jrt/jrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void jerry_jrt_set_log_level (jerry_log_level_t level);
*/
#if defined(__clang__) || defined(__GNUC__)
/* Clang/GCC will not tail call given inline volatile assembly. */
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__ ("")
#else /* !defined(__clang__) && !defined(__GNUC__) */
/* On GCC 10.x this version also works. */
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() \
Expand Down
8 changes: 4 additions & 4 deletions jerry-ext/include/jerryscript-ext/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ typedef struct jerryx_native_module_t
#pragma section(".CRT$XCU", read)
#pragma section(".CRT$XTU", read)

#define JERRYX_MSVC_FUNCTION_ON_SECTION(sec_name, f) \
static void f (void); \
__pragma (JERRYX_MSVC_INCLUDE_SYM (f##_section)) __declspec(allocate (sec_name)) \
JERRYX_MSCV_EXTERN_C void (*f##_section) (void) = f; \
#define JERRYX_MSVC_FUNCTION_ON_SECTION(sec_name, f) \
static void f (void); \
__pragma (JERRYX_MSVC_INCLUDE_SYM (f##_section)) __declspec (allocate (sec_name)) \
JERRYX_MSCV_EXTERN_C void (*f##_section) (void) = f; \
static void f (void)

#define JERRYX_MODULE_CONSTRUCTOR(f) JERRYX_MSVC_FUNCTION_ON_SECTION (".CRT$XCU", f)
Expand Down
18 changes: 9 additions & 9 deletions jerry-main/benchmark/main-benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ run (void)
#endif /* !(defined ( __linux__) && __linux__) */

#if defined(__x86_64__)
#define STACK_SAVE(TARGET) \
{ \
__asm volatile("mov %%rsp, %0" : "=m"(TARGET)); \
#define STACK_SAVE(TARGET) \
{ \
__asm volatile ("mov %%rsp, %0" : "=m"(TARGET)); \
}
#elif defined(__i386__)
#define STACK_SAVE(TARGET) \
{ \
__asm volatile("mov %%esp, %0" : "=m"(TARGET)); \
#define STACK_SAVE(TARGET) \
{ \
__asm volatile ("mov %%esp, %0" : "=m"(TARGET)); \
}
#elif defined(__arm__)
#define STACK_SAVE(TARGET) \
{ \
__asm volatile("mov %0, sp" : "=r"(TARGET)); \
#define STACK_SAVE(TARGET) \
{ \
__asm volatile ("mov %0, sp" : "=r"(TARGET)); \
}
#else /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */
#error "Unsupported stack measurement target!"
Expand Down
2 changes: 1 addition & 1 deletion tools/check-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
RE_FUNCTION_NAME_COMMENT = re.compile(
r"^\}(?!(?:\s\/\*\s\w+\s\*\/$|\s?\w*;))", re.MULTILINE)

CLANG_FORMAT_MIN_VERSION = 10
CLANG_FORMAT_MIN_VERSION = 15

FOLDERS = ["jerry-core",
"jerry-ext",
Expand Down

0 comments on commit b08fbe9

Please sign in to comment.