Skip to content

Commit 3b876f7

Browse files
authored
Update clang-format (#5112)
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 [email protected]
1 parent ef4cb2b commit 3b876f7

File tree

9 files changed

+27
-31
lines changed

9 files changed

+27
-31
lines changed

.github/workflows/gh-actions.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@ jobs:
1616
with:
1717
python-version: '3.10'
1818
- run: sudo apt update
19-
# TODO: update checkers to current versions available in ubuntu 22.04
20-
# - run: sudo apt install clang-format-10 python-serial
21-
- run: sudo apt install pylint doxygen cppcheck
19+
- run: sudo apt install pylint doxygen cppcheck clang-format-15
2220
- run: $RUNNER --check-signed-off=gh-actions
2321
if: ${{ always() }}
2422
- run: $RUNNER --check-doxygen
2523
if: ${{ always() }}
26-
# - run: $RUNNER --check-format
27-
# if: ${{ always() }}
24+
- run: $RUNNER --check-format
25+
if: ${{ always() }}
2826
- run: $RUNNER --check-license
2927
if: ${{ always() }}
30-
# - run: $RUNNER --check-strings
31-
# if: ${{ always() }}
28+
- run: $RUNNER --check-strings
29+
if: ${{ always() }}
3230
- run: $RUNNER --check-pylint
3331
if: ${{ always() }}
3432
- run: $RUNNER --check-cppcheck

jerry-core/api/jerry-snapshot.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ typedef struct
9292
bool class_found;
9393
} snapshot_globals_t;
9494

95-
9695
/**
9796
* Write data into the specified buffer.
9897
*

jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ ecma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type,
261261
typedef ecma_value_t (*ecma_builtin_helper_sort_compare_fn_t) (ecma_value_t lhs, /**< left value */
262262
ecma_value_t rhs, /**< right value */
263263
ecma_value_t compare_func, /**< compare function */
264-
ecma_object_t *array_buffer_p /**< arrayBuffer */
265-
);
264+
ecma_object_t *array_buffer_p /**< arrayBuffer */);
266265

267266
ecma_value_t ecma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p,
268267
uint32_t length,

jerry-core/ecma/operations/ecma-objects.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,9 +1850,9 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
18501850
prop_desc_p->value = property_ref.virtual_value;
18511851
}
18521852

1853-
prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED);
1854-
prop_desc_p->flags = (uint16_t) (
1855-
prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
1853+
prop_desc_p->flags |=
1854+
(uint16_t) (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED
1855+
| (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
18561856
}
18571857
else
18581858
{

jerry-core/include/jerryscript-compiler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ JERRY_C_API_BEGIN
6464
/*
6565
* Compiler-specific macros relevant for Microsoft Visual C/C++ Compiler.
6666
*/
67-
#define JERRY_ATTR_DEPRECATED __declspec(deprecated)
68-
#define JERRY_ATTR_NOINLINE __declspec(noinline)
69-
#define JERRY_ATTR_NORETURN __declspec(noreturn)
67+
#define JERRY_ATTR_DEPRECATED __declspec (deprecated)
68+
#define JERRY_ATTR_NOINLINE __declspec (noinline)
69+
#define JERRY_ATTR_NORETURN __declspec (noreturn)
7070

7171
/*
7272
* Microsoft Visual C/C++ Compiler doesn't support for VLA, using _alloca

jerry-core/jrt/jrt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void jerry_jrt_set_log_level (jerry_log_level_t level);
217217
*/
218218
#if defined(__clang__) || defined(__GNUC__)
219219
/* Clang/GCC will not tail call given inline volatile assembly. */
220-
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
220+
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__ ("")
221221
#else /* !defined(__clang__) && !defined(__GNUC__) */
222222
/* On GCC 10.x this version also works. */
223223
#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() \

jerry-ext/include/jerryscript-ext/module.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ typedef struct jerryx_native_module_t
6262
#pragma section(".CRT$XCU", read)
6363
#pragma section(".CRT$XTU", read)
6464

65-
#define JERRYX_MSVC_FUNCTION_ON_SECTION(sec_name, f) \
66-
static void f (void); \
67-
__pragma (JERRYX_MSVC_INCLUDE_SYM (f##_section)) __declspec(allocate (sec_name)) \
68-
JERRYX_MSCV_EXTERN_C void (*f##_section) (void) = f; \
65+
#define JERRYX_MSVC_FUNCTION_ON_SECTION(sec_name, f) \
66+
static void f (void); \
67+
__pragma (JERRYX_MSVC_INCLUDE_SYM (f##_section)) __declspec (allocate (sec_name)) \
68+
JERRYX_MSCV_EXTERN_C void (*f##_section) (void) = f; \
6969
static void f (void)
7070

7171
#define JERRYX_MODULE_CONSTRUCTOR(f) JERRYX_MSVC_FUNCTION_ON_SECTION (".CRT$XCU", f)

jerry-main/benchmark/main-benchmark.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,19 @@ run (void)
162162
#endif /* !(defined ( __linux__) && __linux__) */
163163

164164
#if defined(__x86_64__)
165-
#define STACK_SAVE(TARGET) \
166-
{ \
167-
__asm volatile("mov %%rsp, %0" : "=m"(TARGET)); \
165+
#define STACK_SAVE(TARGET) \
166+
{ \
167+
__asm volatile ("mov %%rsp, %0" : "=m"(TARGET)); \
168168
}
169169
#elif defined(__i386__)
170-
#define STACK_SAVE(TARGET) \
171-
{ \
172-
__asm volatile("mov %%esp, %0" : "=m"(TARGET)); \
170+
#define STACK_SAVE(TARGET) \
171+
{ \
172+
__asm volatile ("mov %%esp, %0" : "=m"(TARGET)); \
173173
}
174174
#elif defined(__arm__)
175-
#define STACK_SAVE(TARGET) \
176-
{ \
177-
__asm volatile("mov %0, sp" : "=r"(TARGET)); \
175+
#define STACK_SAVE(TARGET) \
176+
{ \
177+
__asm volatile ("mov %0, sp" : "=r"(TARGET)); \
178178
}
179179
#else /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */
180180
#error "Unsupported stack measurement target!"

tools/check-format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
RE_FUNCTION_NAME_COMMENT = re.compile(
3131
r"^\}(?!(?:\s\/\*\s\w+\s\*\/$|\s?\w*;))", re.MULTILINE)
3232

33-
CLANG_FORMAT_MIN_VERSION = 10
33+
CLANG_FORMAT_MIN_VERSION = 15
3434

3535
FOLDERS = ["jerry-core",
3636
"jerry-ext",

0 commit comments

Comments
 (0)