mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-21 16:17:58 +00:00
Fix parsing of declarations like "int const* doStuff(void)".
The "const" in this case was not correctly stripped from the return type, leading to a double const in generated typedefs, i.e.: typedef const int const* (* doStuff_CALLBACK)(int cmock_num_calls); Add a test for these cases.
This commit is contained in:
@@ -228,8 +228,8 @@ class CMockHeaderParser
|
||||
|
||||
#process function attributes, return type, and name
|
||||
descriptors = regex_match[1]
|
||||
descriptors.gsub!(/\s+\*/,'*') #remove space to place asterisks with return type (where they belong)
|
||||
descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from function name to place asterisks with return type (where they belong)
|
||||
descriptors.gsub!(/(\w)\*/,'\1 *') #pull asterisks away from preceding word
|
||||
descriptors.gsub!(/\*(\w)/,'* \1') #pull asterisks away from following word
|
||||
descriptors = descriptors.split #array of all descriptor strings
|
||||
|
||||
#grab name
|
||||
@@ -249,7 +249,7 @@ class CMockHeaderParser
|
||||
end
|
||||
end
|
||||
decl[:modifier] = decl[:modifier].join(' ')
|
||||
rettype = rettype.join(' ')
|
||||
rettype = rettype.join(' ').gsub(/\s+\*/,'*') #remove space before asterisks
|
||||
rettype = 'void' if (@local_as_void.include?(rettype.strip))
|
||||
decl[:return] = { :type => rettype,
|
||||
:name => 'cmock_to_return',
|
||||
|
||||
Reference in New Issue
Block a user