Skip to content

Commit

Permalink
Allow compilation on older gcc versions
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Jan 9, 2024
1 parent f158865 commit 508fb79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/nokogiri/xml_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ dealloc(void *data)

ruby_xfree(doc->_private);

#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // xmlDeregisterNodeDefault is deprecated as of libxml2 2.11.0
#endif
/*
* libxml-ruby < 3.0.0 uses xmlDeregisterNodeDefault. If the user is using one of those older
* versions, the registered callback from libxml-ruby will access the _private pointers set by
Expand All @@ -90,7 +92,9 @@ dealloc(void *data)
if (xmlDeregisterNodeDefaultValue) {
remove_private((xmlNodePtr)doc);
}
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic pop
#endif

xmlFreeDoc(doc);
}
Expand Down

0 comments on commit 508fb79

Please sign in to comment.