masak1yu opened a new pull request, #3419:
URL: https://github.com/apache/thrift/pull/3419

   ## Problem
   
   clang 21 introduced `-Wdefault-const-init-field-unsafe`, which fires on Ruby 
3.2's `rstring.h:465`:
   
   ```c
   struct RString retval;  // has const field (klass) via RBasic → triggers 
warning
   ```
   
   Because `extconf.rb` unconditionally adds `-Werror`, this new warning causes 
the native extension build to fail with:
   
   ```
   error: default initialization of an object of type 'struct RString' with 
const member
          leaves the object uninitialized 
[-Werror,-Wdefault-const-init-field-unsafe]
   ```
   
   This affects macOS users on Xcode 26 / Nix with LLVM 21 when building 
against Ruby 3.2.
   
   ## Root cause
   
   The warning is in Ruby's own headers (`rstring.h`), not in Thrift code. Ruby 
3.2 did not anticipate this warning being added to clang.
   
   ## Fix
   
   Add `append_cflags("-Wno-default-const-init-field-unsafe")` after the 
existing flags. Since `append_cflags` silently ignores flags that the compiler 
doesn't recognize, this is safe on all older clang versions.
   
   ## Testing
   
   ```sh
   gem build thrift.gemspec
   gem install thrift-*.gem
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to