Skip to content

Remove macro support in ruby.h #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ruby_header_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def create_typeref(definition:, function_name:, typeref_field:, filepath:, line_
def parse_typeref_type(definition:, function_name:, typeref_field:, filepath:, line_num:)
typeref_type =
if typeref_field
typeref_field.gsub(/[A-Z_]+\s*\(\(.*\)\)/, "").gsub("RUBY_SYMBOL_EXPORT_BEGIN", "")
typeref_field.gsub(/[A-Z_]+\s*\(\(.*\)\)/, "")
else
# parse typeref in definition
type = definition[0...definition.index(function_name)] || ""
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_header_parser/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.split_signature(signature)
# @param type [String]
# @return [String]
def self.sanitize_type(type)
type.gsub(/(RUBY_EXTERN|enum|volatile|const|struct|static\s+inline)\s+/i, "").gsub("const*", "").strip
type.gsub(/(enum|volatile|const|struct|static\s+inline)\s+/i, "").gsub("const*", "").strip
end
end
end
4 changes: 2 additions & 2 deletions spec/ruby_header_parser/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
subject { RubyHeaderParser::Util.sanitize_type(type) }

using RSpec::Parameterized::TableSyntax

where(:type, :expected) do
"RUBY_EXTERN int" | "int"
"RUBY_EXTERN volatile int" | "int"
"volatile int" | "int"
"enum rb_io_buffer_flags" | "rb_io_buffer_flags"
"const char*" | "char*"
"volatile size_t" | "size_t"
Expand Down
close