Skip to content
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

Fix #1048, filter only whole words for keyword match #1049

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ut-stubs/osapi-timebase-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ extern void UT_DefaultHandler_OS_TimeBaseGetInfo(void *, UT_EntryKey_t, const UT
* Generated stub function for OS_TimeBaseCreate()
* ----------------------------------------------------
*/
int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_TimerSync_t al_sync)
int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_TimerSync_t external_sync)
{
UT_GenStub_SetupReturnBuffer(OS_TimeBaseCreate, int32);

UT_GenStub_AddParam(OS_TimeBaseCreate, osal_id_t *, timebase_id);
UT_GenStub_AddParam(OS_TimeBaseCreate, const char *, timebase_name);
UT_GenStub_AddParam(OS_TimeBaseCreate, OS_TimerSync_t, al_sync);
UT_GenStub_AddParam(OS_TimeBaseCreate, OS_TimerSync_t, external_sync);

UT_GenStub_Execute(OS_TimeBaseCreate, Basic, UT_DefaultHandler_OS_TimeBaseCreate);

Expand Down
18 changes: 12 additions & 6 deletions ut_assert/scripts/generate_stubs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
}
close(HDR);

foreach (@lines)
{
# Truncate each line at C++-style comment
s/\/\/.*$//;
}

# combine all content into a single string
# this eases processing of multi-line constructs
$file = join('', @lines);
Expand All @@ -155,20 +161,20 @@

# Now Find function prototypes
foreach (@lines) {
next if (/typedef/); # ignore typedefs
next if (/static inline/); # ignore
next if (/\btypedef\b/); # ignore typedefs
next if (/\bstatic inline\b/); # ignore


# discard "extern" qualifier
# (but other qualifiers like "const" are OK and should be preserved, as
# it is part of return type).
s/extern//;
s/\bextern\b//;

# The following macros are defined in OSAL common_types.h as function attributes
# They may appear on other function declarations, and should be ignored here.
s/_EXTENSION_//;
s/OS_USED//;
s/OS_PRINTF\(.*?\)//;
s/\b_EXTENSION_\b//;
s/\bOS_USED\b//;
s/\bOS_PRINTF\(.*?\)//;

# scrub whitespace for consistency - multiple spaces become single space
# and trim leading/trailing spaces again
Expand Down