mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-25 12:39:57 +00:00
Strip out nested pairs of braces in order to protect against function definitions in the header files (inline or otherwise).
This commit is contained in:
@@ -93,12 +93,13 @@ class CMockHeaderParser
|
||||
"#{functype} #{$2.strip}(#{$3});"
|
||||
end
|
||||
|
||||
# remove nested pairs of braces because no function declarations will be inside of them (leave outer pair for function definition detection)
|
||||
while source.gsub!(/\{[^\{\}]*\{[^\{\}]*\}[^\{\}]*\}/m, '{ }')
|
||||
end
|
||||
|
||||
# remove function definitions by stripping off the arguments right now
|
||||
source.gsub!(/\([^\)]*\)\s*\{[^\}]*\}/m, ";")
|
||||
|
||||
# remove pairs of braces because no function declarations will be inside of them
|
||||
#source.gsub!(/\{[^\}]*\}/m, '')
|
||||
|
||||
#drop extra white space to make the rest go faster
|
||||
source.gsub!(/^\s+/, '') # remove extra white space from beginning of line
|
||||
source.gsub!(/\s+$/, '') # remove extra white space from end of line
|
||||
|
||||
Reference in New Issue
Block a user