mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-15 13:27:26 +00:00
Fix bug in parenthetical statements being misinterpreted as functions. (Issue #414)
This commit is contained in:
@@ -14,7 +14,7 @@ class CMockHeaderParser
|
|||||||
@c_calling_conventions = cfg.c_calling_conventions.uniq
|
@c_calling_conventions = cfg.c_calling_conventions.uniq
|
||||||
@treat_as_array = cfg.treat_as_array
|
@treat_as_array = cfg.treat_as_array
|
||||||
@treat_as_void = (['void'] + cfg.treat_as_void).uniq
|
@treat_as_void = (['void'] + cfg.treat_as_void).uniq
|
||||||
@function_declaration_parse_base_match = '([\w\s\*\(\),\[\]]+??)\(([\w\s\*\(\),\.\[\]+\-\/]*)\)'
|
@function_declaration_parse_base_match = '([\w\s\*\(\),\[\]]*?\w[\w\s\*\(\),\[\]]*?)\(([\w\s\*\(\),\.\[\]+\-\/]*)\)'
|
||||||
@declaration_parse_matcher = /#{@function_declaration_parse_base_match}$/m
|
@declaration_parse_matcher = /#{@function_declaration_parse_base_match}$/m
|
||||||
@standards = (%w[int short char long unsigned signed] + cfg.treat_as.keys).uniq
|
@standards = (%w[int short char long unsigned signed] + cfg.treat_as.keys).uniq
|
||||||
@array_size_name = cfg.array_size_name
|
@array_size_name = cfg.array_size_name
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ typedef struct _POINT_T
|
|||||||
int y;
|
int y;
|
||||||
} POINT_T;
|
} POINT_T;
|
||||||
|
|
||||||
// typedef edge case;
|
/* typedef edge case;
|
||||||
// not ANSI C but it has been done and will break cmock if not handled
|
not ANSI C but it has been done and will break cmock if not handled */
|
||||||
typedef void VOID_TYPE_CRAZINESS;
|
typedef void VOID_TYPE_CRAZINESS;
|
||||||
|
|
||||||
/* fun parsing & mock generation cases */
|
/* fun parsing & mock generation cases */
|
||||||
@@ -36,6 +36,9 @@ char
|
|||||||
int a,
|
int a,
|
||||||
unsigned int b);
|
unsigned int b);
|
||||||
|
|
||||||
|
/* this isn't a function, despite the parenthesis */
|
||||||
|
static const unsigned int foo = (1);
|
||||||
|
|
||||||
U16 *ptr_return1(int a);
|
U16 *ptr_return1(int a);
|
||||||
U16* ptr_return2(int a);
|
U16* ptr_return2(int a);
|
||||||
U16 * ptr_return3(int a);
|
U16 * ptr_return3(int a);
|
||||||
|
|||||||
Reference in New Issue
Block a user