Skip to content

Update CRuby extension deprecated macros#8

Merged
gemmaro merged 1 commit into
ruby-gettext:mainfrom
WilliamK112:fix/cruby-deprecated-macros
Jun 17, 2026
Merged

Update CRuby extension deprecated macros#8
gemmaro merged 1 commit into
ruby-gettext:mainfrom
WilliamK112:fix/cruby-deprecated-macros

Conversation

@WilliamK112

Copy link
Copy Markdown
Contributor

Summary

  • Replace CRuby extension DATA_PTR uses with RTYPEDDATA_DATA for objects allocated through TypedData_Wrap_Struct.
  • Replace deprecated CRuby Qnil/Qtrue/Qfalse/Qundef constants with the RUBY_Q* forms.
  • Leave the mruby implementation untouched because these issues are scoped to CRuby.

Closes #6
Closes #7

Validation

  • rg -n \b(DATA_PTR|Qnil|Qtrue|Qfalse|Qundef)\b ext/gettextpo/gettextpo.c returns no matches
  • clang-format --dry-run --Werror ext/gettextpo/gettextpo.c
  • git diff --check

Notes

I could not run bundle exec rake test locally because this Windows environment does not have Ruby/Bundler or libgettextpo headers installed on PATH.

@WilliamK112

Copy link
Copy Markdown
Contributor Author

Quick CI note: the failing deploy check appears to be an environment-protection failure rather than a code/build failure. The build-and-deploy job completed successfully, including RDoc generation and Pages artifact upload. The failed deploy job has these annotations:

  • Branch refs/pull/8/merge is not allowed to deploy to github-pages due to environment protection rules.
  • The deployment was rejected or didn't satisfy other protection rules.

So I don't see an actionable change needed in this PR for that check.

@gemmaro

gemmaro commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@WilliamK112 Hi,

I could not run bundle exec rake test locally because this Windows environment does not have Ruby/Bundler or libgettextpo headers installed on PATH.

You should take some time to setup environment locally and check if it builds and passes tests. The setup on Windows is surely harder than on *nix, but it's worth learning for Ruby+C beginners.

@WilliamK112

Copy link
Copy Markdown
Contributor Author

Thanks for the nudge. I set up a local Ruby+C environment for this branch on Windows using MSYS2/UCRT:

  • Ruby 3.4.9 (x64-mingw-ucrt)
  • GCC 16.1.0
  • gettext-po.h and libgettextpo from the UCRT gettext package
  • Bundler 2.6.9

I then installed the gem dependencies and ran the native build/test path locally:

rake test
checking for gettext-po.h... yes
checking for -lgettextpo... yes
checking for po_message_get_format() in gettext-po.h... yes
linking shared-object gettextpo/gettextpo.so
2 tests, 22 assertions, 0 failures, 0 errors

So the extension builds and the current CRuby tests pass on this Windows/MSYS2 UCRT setup. I also cleaned the generated local build artifacts afterward; no PR changes were needed.

@gemmaro

gemmaro commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Thank you, sounds good to me.

@gemmaro gemmaro merged commit eb1bb25 into ruby-gettext:main Jun 17, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRuby: Use RUBY_ prefixes for, e.g. Qnil CRuby: RTYPEDDATA_DATA might be better than DATA_PTR

2 participants