-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix function definition regex bug #6547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mbolivar-nordic
merged 2 commits into
nrfconnect:main
from
gregersrygg:fix-func-def-regex
Jan 21, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # | ||
| # Copyright (c) 2022 Nordic Semiconductor | ||
| # | ||
| # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| # | ||
|
|
||
| cmake_minimum_required(VERSION 3.20.0) | ||
|
|
||
| find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
| project(wrap_test) | ||
|
|
||
| # generate runner for the test | ||
| test_runner_generate(src/wrap_test.c) | ||
|
|
||
| # create mocks for test_code functions | ||
| cmock_handle(src/test_code/test_code.h test_code) | ||
|
|
||
| # add module test_code | ||
| target_sources(app PRIVATE src/test_code/test_code.c) | ||
| target_include_directories(app PRIVATE src) | ||
|
|
||
| # add module call | ||
| target_sources(app PRIVATE src/call/call.c) | ||
| target_include_directories(app PRIVATE ./src/call) | ||
|
|
||
| # add test file | ||
| target_sources(app PRIVATE src/wrap_test.c) | ||
| target_include_directories(app PRIVATE .) | ||
| target_include_directories(app PRIVATE src/test_code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # | ||
| # Copyright (c) 2022 Nordic Semiconductor ASA | ||
| # | ||
| # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| # | ||
| CONFIG_UNITY=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright (c) 2022 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
| #include <sys/util.h> | ||
| #include <stddef.h> | ||
|
|
||
| #include "call.h" | ||
| #include "test_code/test_code.h" | ||
|
|
||
| void call_syscall(void) | ||
| { | ||
| syscall(); | ||
| } | ||
|
|
||
| int call_static_inline_fn(void) | ||
| { | ||
| return static_inline_fn(); | ||
| } | ||
|
|
||
| int call_inline_static_fn(void) | ||
| { | ||
| return inline_static_fn(); | ||
| } | ||
|
|
||
| int call_always_inline_fn(void) | ||
| { | ||
| return always_inline_fn(); | ||
| } | ||
|
|
||
| int call_after_macro(void) | ||
| { | ||
| return after_macro(); | ||
| } | ||
|
|
||
| int call_extra_whitespace(void) | ||
| { | ||
| return extra_whitespace(); | ||
| } | ||
|
|
||
| int call_multiline_def(int arg, int len) | ||
| { | ||
| return multiline_def(arg, len); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright (c) 2022 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
| #ifndef __CALL_H | ||
| #define __CALL_H | ||
|
|
||
| void call_syscall(void); | ||
| int call_static_inline_fn(void); | ||
| int call_inline_static_fn(void); | ||
| int call_always_inline_fn(void); | ||
| int call_after_macro(void); | ||
| int call_extra_whitespace(void); | ||
| int call_multiline_def(int arg, int len); | ||
|
|
||
| #endif /* __CALL_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "DisableFormat": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| * Copyright (c) 2022 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
|
|
||
| #include "test_code/test_code.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright (c) 2022 Nordic Semiconductor ASA | ||
| * | ||
| * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
| */ | ||
|
|
||
| /* | ||
| * DO NOT FORMAT THIS FILE! | ||
| * | ||
| * It contains various code blocks that is used to validate the test wrapper | ||
| * scripts (func_name_list.py and header_parse.py) which renames function | ||
| * declarations. The regular expression has had several bugs in the past, and | ||
| * the formating of the code here is used to validate that the fixes still work | ||
| * when modifying the regex. | ||
| * | ||
| * The code in this file ensure that the test wrapper scripts can handle the | ||
| * situations described in following list of issues: | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/1413 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/2182 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/3432 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/5069 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/5814 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/6478 | ||
| * https://github.com/nrfconnect/sdk-nrf/pull/6547 | ||
| */ | ||
|
|
||
| #ifndef __TEST_CODE_H | ||
| #define __TEST_CODE_H | ||
|
|
||
| // c++ comment | ||
| /* c comment */ | ||
| /* c | ||
| * multi line comment | ||
| */ | ||
| #define SOME_ADDR "https://my.page.com/somewhere" | ||
|
|
||
| static const char test_string[] = "test string"; | ||
|
|
||
| #define TEST_MACRO(xx) do { \ | ||
| const STRUCT_SECTION_ITERABLE(settings_handler_static, \ | ||
| name) \ | ||
| } while (0) | ||
|
|
||
| static inline int inline_static_fn(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| inline static int static_inline_fn(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| static ALWAYS_INLINE int always_inline_fn(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| __syscall void syscall(void); | ||
|
|
||
| static inline void z_impl_syscall(void) | ||
| { | ||
| /* empty */ | ||
| } | ||
|
|
||
| /* macro function that was parsed incorrectly (NCSDK-10918) */ | ||
| #define SETTINGS_STATIC_HANDLER_DEFINE(_hname, _tree, _get, _set, _commit, \ | ||
| _export) \ | ||
| const Z_STRUCT_SECTION_ITERABLE(settings_handler_static, \ | ||
| settings_handler_ ## _hname) = { \ | ||
| .name = _tree, \ | ||
| .h_get = _get, \ | ||
| .h_set = _set, \ | ||
| .h_commit = _commit, \ | ||
| .h_export = _export, \ | ||
| } | ||
| int after_macro(void); | ||
|
|
||
| int extra_whitespace (void) ; | ||
|
|
||
| /* typedef that should not be parsed as a function */ | ||
| typedef struct __attribute__ ((__packed__)) { | ||
| } bar_t; | ||
|
|
||
| /* newline between arguments */ | ||
| int multiline_def(int arg, | ||
| int len); | ||
|
|
||
| #endif /* __TEST_CODE_H */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.