Skip to content

Commit

Permalink
Merge pull request #1049 from jphickey/fix-1048-extern-strings
Browse files Browse the repository at this point in the history
Fix #1048, filter only whole words for keyword match
  • Loading branch information
astrogeco authored Jun 2, 2021
2 parents d57e3d6 + e8add95 commit d5d370a
Show file tree
Hide file tree
Showing 2 changed files with 14 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
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

0 comments on commit d5d370a

Please sign in to comment.