Project

General

Profile

« Previous | Next » 

Revision 08fefd70

Added by nobu (Nobuyoshi Nakada) over 9 years ago

ruby.h: fix for old clang

  • include/ruby/ruby.h (rb_scan_args): add nul padding here to
    apply to all references.

  • include/ruby/ruby.h (rb_scan_args_verify): move length mismatch
    check outside conditional operators.

Since old clang cannot optimize away string literal dereference by
an immediate index, e.g., ""[0], and both of true and false side
expressions are compiled and warned unintentionally. With such
old compilers, the check in rb_scan_args() does not work but may
result unpredictable value if the format is wrong.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e