File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ def transform_inline_functions(source)
137137 # If the user uses a macro to declare an inline function,
138138 # smushing the macros makes it easier to recognize them as a macro and if required,
139139 # remove them later on in this function
140- source . gsub! ( /\s *\\ \s * /m , ' ' )
140+ source . gsub! ( /\s *\\ ( \n | \s *) /m , ' ' )
141141
142142 # Just looking for static|inline in the gsub is a bit too aggressive (functions that are named like this, ...), so we try to be a bit smarter
143143 # Instead, look for an inline pattern (f.e. "static inline") and parse it.
Original file line number Diff line number Diff line change @@ -2867,5 +2867,19 @@ class Classy {
28672867 assert_equal ( expected , @parser . transform_inline_functions ( source ) )
28682868 end
28692869
2870+ it "Transform macros with escapes of empty lines" do
2871+ source =
2872+ "#define some_msg_t_FIELDLIST(X, a) \\ \n " +
2873+ "\n " +
2874+ "#define some_msg_t_CALLBACK NULL\n "
2875+
2876+ expected =
2877+ "#define some_msg_t_FIELDLIST(X, a) \n " +
2878+ "#define some_msg_t_CALLBACK NULL\n "
2879+
2880+ @parser . treat_inlines = :include
2881+ assert_equal ( expected , @parser . transform_inline_functions ( source ) )
2882+ end
2883+
28702884
28712885end
You can’t perform that action at this time.
0 commit comments