虚無庵

徒然なるままに

今日の ruby build 2023-08-31

今日のビルド

c45176dbca2bd082cb199e9411e4dfc5ec162352 までを pull ってきてビルド。エラー/警告ともになし。

  Files:       1023

  Classes:     1206 ( 281 undocumented)
  Modules:      233 (  84 undocumented)
  Constants:   1455 ( 717 undocumented)
  Attributes:  1399 ( 278 undocumented)
  Methods:    11193 (2304 undocumented)

  Total:      15486 (3664 undocumented)
   76.34% documented

  Elapsed: 30.2s

今日のテスト

PASS all 1853 tests

今日のビルド(Universal Parser 有効化)

c45176dbca2bd082cb199e9411e4dfc5ec162352 までを pull ってきてビルド。

../ruby_parser.c: In function ‘syntax_error_append’:
../ruby_parser.c:117:5: warning: function ‘syntax_error_append’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
  117 |     return rb_syntax_error_append(exc, file, line, column, (rb_encoding *)enc, fmt, args);
      |     ^~~~~~
../ruby_parser.c: In function ‘rb_parser_config_initialize’:
../ruby_parser.c:621:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  621 |     config->str_catf        = rb_str_catf;
      |                             ^
../ruby_parser.c:639:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  639 |     config->str_vcatf       = rb_str_vcatf;
      |                             ^
../ruby_parser.c:641:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  641 |     config->rb_sprintf      = rb_sprintf;
      |                             ^
../ruby_parser.c:728:19: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  728 |     config->raise = rb_raise;
      |                   ^
../ruby_parser.c:750:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  750 |     config->compile_warn    = rb_compile_warn;
      |                             ^
../ruby_parser.c:751:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  751 |     config->compile_warning = rb_compile_warning;
      |                             ^
../ruby_parser.c:752:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  752 |     config->bug             = rb_bug;
      |                             ^
../ruby_parser.c:753:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  753 |     config->fatal           = rb_fatal;
      |                             ^
../ruby_parser.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics

出ている警告内容に変化なし。

  Files:       1020

  Classes:     1206 ( 281 undocumented)
  Modules:      233 (  84 undocumented)
  Constants:   1455 ( 717 undocumented)
  Attributes:  1399 ( 278 undocumented)
  Methods:    11193 (2304 undocumented)

  Total:      15486 (3664 undocumented)
   76.34% documented

  Elapsed: 32.9s

今日のテスト(Universal Parser 有効化)

PASS all 1853 tests

そろそろ修正パッチを投げたいわけだが

../ruby_parser.c:750:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wsuggest-attribute=format]
  750 |     config->compile_warn    = rb_compile_warn;
      |                             ^

これに対して修正できないものかを火曜日の Hamada.rb からチャレンジしているが解決までに至っていない。

snprintf の対応のやつを参考にすると

  • 警告メッセージが発生する ruby_parser.c の該当部分を削除
  • rubyparser.h の snprintf の宣言箇所を削除
  • parse.y に snprintf 相当の機能を実装

としているので同様のことをやるならば

  • 警告メッセージが発生する ruby_parser.c の該当部分を削除
  • rubyparser.h の compile_warn の宣言箇所を削除
  • parse.y に compile_warn 相当の機能を実装

になると思うのだが、そうは問屋が卸してくれない。

rb_compile_warn 関数自体は error.c にも実装されているため、parse.y で同名関数を宣言できない。また、NIL_P, ruby_verbose, with_warn_vsprintf, rb_write_warning_str をすべて parse.y 内だけで完結する実装に置き換えなければならない(と思う)。 自力で解決するにはまだ時間がかかりそう。