Skip to content

Commit

Permalink
Fix nasa#1048, filter only whole words for keyword match
Browse files Browse the repository at this point in the history
In the stub generator script, filter only whole words
when ignoring keywords.  Do not match if the word appears
as a substring inside a larger word.
  • Loading branch information
jphickey authored and pepepr08 committed Jun 9, 2021
1 parent f62556f commit d35ce9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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
12 changes: 6 additions & 6 deletions ut_assert/scripts/generate_stubs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,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

0 comments on commit d35ce9d

Please sign in to comment.