Граф коммитов

394 Коммитов

Автор SHA1 Сообщение Дата
卜部昌平 d69c532685 configure: suppress SunPro warning
To this date there is no way for Oracle developer Studio to suppress
warnings about unreachable codes (12.6 manual says it implemented
__builtin_unreachable "as a no-op to C++. It might be added to C.")

There is no way but globally kill the warning.
2020-04-10 16:17:30 +09:00
卜部昌平 75802bcff1 configure: suppress icc warnings
Every time a pointer to/from VALUE conversion happens, these two
warnings are issued:

- warning #1684: conversion from pointer to same-sized integral type (potential portability problem)
- warning #2312: pointer cast involving 64-bit pointed-to type

Thank you, but we are well aware of the "potential portability problem".
Let us ignore them all.
2020-04-10 16:17:30 +09:00
卜部昌平 e43237b115 configure: always check for __builtin_unreachable
Non-gcc compilers tend to have this intrinsic these days (e.g. icc).
Better check it regardless of $GCC.
2020-04-10 16:17:30 +09:00
Yusuke Endoh cdd613b299 configure.ac: Skip C++ compiler of Sun OpenStudio
It fails to compile ext/-test-/cxxanyargs/cxxanyargs.cpp.
Need work to support it.  Contribution is welcome.
2020-04-09 08:55:46 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada 4f938ffa35
Use toodir also in configure.ac 2020-04-05 10:56:28 +09:00
Nobuyoshi Nakada 21d0b40de2 Added tooldir variable 2020-04-05 09:26:57 +09:00
Paul Jordan 519a69b55c ucontext doesn't exist in a musl-libc env; use native assembly 2020-04-01 15:49:02 +13:00
Takashi Kokubun 5b3157a511
Make file names and variable names consistent 2020-03-23 22:33:01 -07:00
Nobuyoshi Nakada 6ab3664635
Moved MJIT_WITHOUT_TABS default to configure.ac
And then the environment variable.
2020-03-24 13:46:00 +09:00
Yusuke Endoh df26d36e5b Prefer alignas() over _Alignas()
to allow Intel C++ compiler to read ruby.h.
This is similar to 9930481a23
2020-02-20 22:36:53 +09:00
卜部昌平 cdd75d4e7f support C++ std::nullptr_t
C++ keyword `nullptr` represents a null pointer (note also that NULL is
an integer in C++ due to its design flaw).  Its type is `std::nullptr_t`,
defined in <cstddef> standard header.  Why not support it when the
backend implementation can take a null pointer as an argument.
2020-01-31 13:01:52 +09:00
卜部昌平 13064fe5db avoid undefined behaviour when n==0
ISO/IEC 9899:1999 section 6.5.7 states that "If the value of the right
operand is negative or is greater than or equal to the width of the
promoted left operand, the behavior is undefined".  So we have to take
care of such situations.

This has not been a problem because contemporary C compilers are
extraordinary smart to compile the series of shifts into a single
ROTLQ/ROTRQ machine instruction.  In contrast to what C says those
instructions have fully defined behaviour for all possible inputs.
Hence it has been quite difficult to observe the undefined-ness of such
situations.  But undefined is undefined.  We should not rely on such
target-specific assumptions.

We are fixing the situation by carefully avoiding shifts with out-of-
range values.  At least GCC since 4.6.3 and Clang since 8.0 can issue
the exact same instructions like before the changeset.

Also in case of Intel processors, there supposedly be intrinsics named
_rotr/_rotl that do exactly what we need.  They, in practice, are absent
on Clang before 9.x so we cannot blindly use.  But we can at least save
MSVC.

See also:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57157
https://bugs.llvm.org/show_bug.cgi?id=17332
2020-01-10 21:17:15 +09:00
Koichi Sasada 6f5ee1f092 modify MJIT_CC only on RUBY_DEBUG=ci
Modify MJIT_CC (27fae1d4ad) only on CI environment.
2020-01-03 04:39:34 +09:00
Koichi Sasada 27fae1d4ad disable ccache if $CC is in /usr/lib/ccache/$CC.
MJIT with ccache has a problem on docker environment, so
we need to use original CC (/usr/bin/gcc, for example).
Ubuntu system provides /usr/lib/ccache/gcc and so on to use
gcc with ccache. It is easy to setup ccache by adding
/usr/lib/ccache to $PATH. However we need to use /usr/bin/gcc
(and so on) for MJIT_CC. We can specify MJIT_CC option at
configure, but specifying them is troublesome.

This patch choose original $CC (/usr/bin/gcc, for example)
if $CC is /usr/lib/ccache/$CC.
2020-01-03 02:07:21 +09:00
Jeremy Evans a04c535967 Use __func__ as rb_cv_function_name_string on OpenBSD
The use of RUBY_WERROR_FLAG causes this test to fail on OpenBSD
platforms that use the binutils linker (ld.bfd) instead of the
llvm linker (ld.lld), due to warnings added to the binutils linker
in OpenBSD.

Removing the RUBY_WERROR_FLAG would probably also fix it, but that
would affect other platforms.

This should also be backported to Ruby 2.7.

Analysis and similar fix recommended by George Koehler.
2019-12-28 14:13:05 -08:00
卜部昌平 0958e19ffb add several __has_something macro
With these macros implemented we can write codes just like we can assume
the compiler being clang.  MSC_VERSION_SINCE is defined to implement
those macros, but turned out to be handy for other places.  The -fdeclspec
compiler flag is necessary for clang to properly handle __has_declspec().
2019-12-26 20:45:12 +09:00
Matt Valentine-House 1140625cd3
Allow more than one major version number in target_os 2019-12-13 08:58:42 +09:00
Koichi Sasada 40026a408d support cross-compilation.
On cross-compilation, compiled binary can no be created because
compiled binary should be created by same interpreter (on cross-
compilation, host ruby is used to build ruby (BASERUBY)).
So that cross-compilation system loads required scripts in text.
It is same as miniruby.
2019-12-11 11:24:42 +09:00
Nobuyoshi Nakada e42d9d8df8
Fixed the inverted condition 2019-12-03 14:51:14 +09:00
Nobuyoshi Nakada 9165fcdfa3
Wrap statements in AS_IF properly 2019-12-03 14:46:54 +09:00
Nobuyoshi Nakada a7b9f085ff
Disable _FORTIFY_SOURCE on mingw for now
It causes a link error due to some `__*_chk` functions on mingw.
2019-12-02 13:20:00 +09:00
Mark Abraham 07f2062c8f Improve string literal concatenation for C++11
Downstream C++ projects that compile with C++11 or newer and include
the generated config.h file issue compiler warnings. Both C and C++
compilers do string-literal token pasting regardless of whitespace
between the tokens to paste. C++ compilers since C++11 require such
spaces, to avoid ambiguity with the new style of string literals
introduced then. This change fixes such projects without affecting
core Ruby.
2019-11-06 00:31:52 +09:00
Nobuyoshi Nakada ad4da86669
Check for nonnull attribute in configure 2019-10-29 16:38:15 +09:00
卜部昌平 9195ed18ca Revert "Check for nonnull attribute in configure"
This reverts commit 54eb51d72b.

Windows build failure. See also https://github.com/ruby/ruby/runs/278718805
2019-10-29 16:05:39 +09:00
Nobuyoshi Nakada 54eb51d72b
Check for nonnull attribute in configure 2019-10-29 12:12:07 +09:00
Koichi Sasada 9e07dfd253 show BASERUBY version at configure. 2019-10-20 16:16:54 +09:00
卜部昌平 487d290044 oops
Silly typo.
2019-09-10 16:04:17 +09:00
卜部昌平 20e428ec40 fix CentOS 6 compile error
See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-master/log/20190910T003005Z.fail.html.gz
2019-09-10 12:25:36 +09:00
Jeremy Evans 8d3db4f26c Default to cc/c++ instead of gcc/g++ on OpenBSD 2019-09-09 18:11:52 -07:00
Nobuyoshi Nakada 733aa2f8b5
Stop setting same flags as cflags to cxxflags 2019-09-06 18:43:41 +09:00
Nobuyoshi Nakada dd26c9f333
Check clang++ as CXX when CXX is bare clang without suffix 2019-09-06 18:43:41 +09:00
Kazuhiro NISHIYAMA 76abd79629
Fix the appropriate C++ compiler in OS X selection
Merge space and slash to character class and add missing `CXX=` before `=g++-4.2`
at 5e10cb04e8
2019-08-27 10:43:37 +09:00
Nobuyoshi Nakada 5e10cb04e8
Refined the appropriate C++ compiler in OS X selection
Allows CC to be prefixed another path or command, e.g., ccache.
2019-08-26 11:07:34 +09:00
Yusuke Endoh 365e5b38a9 configure.ac: Improve icc_version guessing for non-icc environment
icc_version was wrongly defined as "__ICC" on non-icc C compiler, which
caused a warning:

```
./configure: line 8211: test: __ICC: integer expression expected
```

This change adds a sed commend to delete "__ICC".
2019-08-25 23:08:13 +09:00
Yusuke Endoh 11f7c30fa7 configure.ac: fix the guess of icc_version
The icc_version guessing was accidentally disabled because of
61885c9b7ca8ccdaf53d7c365fbb86bad3294d88; `AC_PROG_CC_C99` changes
CC like "icc -std=c99", and `AS_CASE(["x$CC"], [xicc],` does not match.

The variable `icc_version` is eventually defined, so the `AS_CASE` is
not needed.  This change removes the `AS_CASE`.
2019-08-25 22:16:26 +09:00
Nobuyoshi Nakada 19b0161b85
Check whether syscall(2) is deprecated by actual warnings 2019-08-20 02:14:28 +09:00
Nobuyoshi Nakada 588b74e8d8
Check for minimum required OSX version earlier 2019-08-20 02:14:28 +09:00
Nobuyoshi Nakada 9ee770a2ce
Bail out if unsupported old MacOSX is required 2019-08-20 02:14:28 +09:00
Nobuyoshi Nakada af2c8d2836
Fixed the check for OSX version
Should compare minimum required version, and with the particular
macro defined for each version.  Also made the error messages
consistent.
2019-08-20 02:14:28 +09:00
David CARLIER 6dd9736c3a crash report on mac little update
displaying vm info as Linux and FreeBSD.
checking libproc as it is present only from 10.5 version.

https://github.com/ruby/ruby/pull/2384
2019-08-19 17:36:28 +09:00
David CARLIER 28267cea08 NetBSD native support of explicit_bzero's like feature (#2145) 2019-08-17 14:17:30 +09:00
Nobuyoshi Nakada 03958a0c0d
Relaxed target_os matching
When target_alias is not empty, `-gnu` suffixed is not stripped.

[Bug #16015]
2019-07-23 18:22:25 +09:00
Samuel Williams 7291fef55c
Improve build process and coroutine implementation selection. 2019-07-18 20:54:54 +12:00
Lars Kanis 68e5804022
Add coroutine context switch for i386-mingw32
It's essentially a translation of Context.asm from Intel
to AT&T syntax.
2019-07-07 21:33:47 +12:00
Jeremy Evans 11c311e36f Use realpath(3) instead of custom realpath implementation if available
This approach is simpler than the previous approach which tries to
emulate realpath(3).  It also performs much better on both Linux and
OpenBSD on the included benchmarks.

By using realpath(3), we can better integrate with system security
features such as OpenBSD's unveil(2) system call.

This does not use realpath(3) on Windows even if it exists, as the
approach for checking for absolute paths does not work for drive
letters.  This can be fixed without too much difficultly, though until
Windows defines realpath(3), there is no need to do so.

For File.realdirpath, where the last element of the path is not
required to exist, fallback to the previous approach, as realpath(3)
on most operating systems requires the whole path be valid (per POSIX),
and the operating systems where this isn't true either plan to conform
to POSIX or may change to conform to POSIX in the future.

glibc realpath(3) does not handle /path/to/file.rb/../other_file.rb
paths, returning ENOTDIR in that case.  Fallback to the previous code
if realpath(3) returns ENOTDIR.

glibc doesn't like realpath(3) usage for paths like /dev/fd/5,
returning ENOENT even though the path may appear to exist in the
filesystem.  If ENOENT is returned and the path exists, then fall
back to the default approach.
2019-07-01 11:46:30 -07:00
Jeremy Evans 81fe82be4e Enable native fiber coroutines on i386-openbsd 2019-07-01 11:44:12 -07:00
Jeremy Evans 7172ab0ec5 Use native coroutine implementation on OpenBSD-amd64
When using native fibers, do not load ucontext, as it isn't needed.
2019-06-26 16:23:11 -07:00
Jeremy Evans d004989ac6 Do not attempt to use ucontext for fibers on OpenBSD
OpenBSD does not support ucontext.

There may be a more generic way to handle this, using the result
of AC_CHECK_HEADERS(ucontext.h).
2019-06-26 07:53:54 -07:00
Samuel Williams acb67472c7 Restore updated implementation of arm32 coroutine code, but prefer ucontext. 2019-06-26 22:02:28 +12:00
Yusuke Endoh 28eeaed8a9 Revert "coroutine/arm32/Context.S: save/restore the registers via stack"
This reverts commit 6df1814c08.

It caused a SEGV again:
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190626T051707Z.fail.html.gz
2019-06-26 17:23:00 +09:00
Samuel Williams 6c6bf9ffcb Add `ucontext` coroutine implementation for generic fallback. 2019-06-26 20:19:53 +12:00
Yusuke Endoh 6df1814c08 coroutine/arm32/Context.S: save/restore the registers via stack
Retry of 518adcca0a and dbe232e24e
2019-06-26 14:08:10 +09:00
Yusuke Endoh 730aeb2523 Revert 518adcca0a and dbe232e24e
518adcca0a: "Try using arm32 implementation for fibers."
dbe232e24e: "Order of arguments might be incorrect in arm32 coroutine implementation."

It seems to cause SEGV consistently on Ubuntu armv7l eabihf:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190625T081710Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20190625T111708Z.fail.html.gz
2019-06-25 23:32:26 +09:00
Samuel Williams 518adcca0a Try using arm32 implementation for fibers. 2019-06-24 19:09:27 +12:00
Samuel Williams 0e6396d2ac Try using arm64 implementation for fibers. 2019-06-24 15:13:17 +12:00
Samuel Williams abdbfebad1 Use spaces for indentation in `configure.ac`. 2019-06-24 15:13:17 +12:00
Samuel Williams d17344cfc5 Remove IA64 support. 2019-06-19 23:30:04 +12:00
Nobuyoshi Nakada c7477c3e1f
Moved Makefile.in under template 2019-06-07 09:09:58 +09:00
Nobuyoshi Nakada 200c840b95
Revert "Moved Makefile.in under template"
This reverts commits:
* 6f9d5fafe0
* bb3c89b643

And remove the dependency of Makefile on Makefile.in
transitionally.
2019-06-07 09:03:25 +09:00
Nobuyoshi Nakada 6f9d5fafe0
Moved Makefile.in under template 2019-06-07 08:44:37 +09:00
Nobuyoshi Nakada d046fe9262
configure.ac: utilize wide columns for summary 2019-06-06 12:03:19 +09:00
Nobuyoshi Nakada 65ce14e7b5
Added --with-rdoc option
New option to direct formats of RDoc to install.
2019-05-25 17:20:31 +09:00
Nobuyoshi Nakada 4fae3c3fb0
Show doc list to install
Show document format list to install, not only enabled or disable.
2019-05-25 17:16:07 +09:00
Nobuyoshi Nakada 9a4d39b95e
No longer svn & git-svn are used 2019-05-10 15:22:54 +09:00
Kazuhiro NISHIYAMA 87cf45a512
Fix a typo 2019-04-23 16:50:15 +09:00
nobu 23a8183bea Check stx_btime in struct statx
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-24 11:57:18 +00:00
glass 8b8285e253 configure.ac: remove check for broken memmem
the bug of memmem(3) was fixed in glibc 2.1 released in 1999.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-24 05:27:33 +00:00
glass dc700cf903 configure.ac: skip check of statx() on AIX
Linux and AIX have statx() with different prototype.

Linux: int statx(int, const char*, int, unsigned int, struct statx*)
AIX: int statx(char, struct stat*, int, int)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-23 04:42:48 +00:00
nobu 15a98ab428 Try statx syscall
* file.c (rb_file_s_birthtime): export for pathname to check if
  birthtime is supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-20 06:54:23 +00:00
glass 88798f0787 file.c: enable File.birthtime on Linux
enable File.birthtime on Linux if statx(2) is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-19 05:44:53 +00:00
glass 1a8583de72 random.c: use getrandom() if available.
getrandom() is supported by glibc 2.25 or later.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-10 08:21:33 +00:00
nobu 74f94b3e6e configure.ac: check finite,isinf,isnan as macros first
[ruby-core:91487] [Bug #15595]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-08 07:22:55 +00:00
nobu cc7dedfb4d configure.ac: separate -std=gnu99 condition
Also necessary on mingw, cygwin, darwin and netbsd.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-04 08:17:44 +00:00
glass 2210709b79 io.c: use fcopyfile(3) in IO.copy_stream if available
fixed r66930.

* io.c (nogvl_copy_stream_func): use fcopyfile(3) in IO.copy_stream if available

* configure.ac: check copyfile.h and fcopyfile(3)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-28 05:04:17 +00:00
glass 774c60955a Revert "io.c: use fcopyfile(3) in IO.copy_stream if available"
This reverts commit bd670062c4.
It fails on rubyspec.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-27 21:46:06 +00:00
glass bd670062c4 io.c: use fcopyfile(3) in IO.copy_stream if available
* io.c (nogvl_copy_stream_func): use fcopyfile(3) in IO.copy_stream if available

* configure.ac: check copyfile.h and fcopyfile(3)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-27 20:55:26 +00:00
nobu bac705529d fix typo in r66836, missing '/'s
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-22 01:56:26 +00:00
glass 12afc11fcd * io.c: use copy_file_range() if defined
* configure.ac: check copy_file_range()

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21 10:11:04 +00:00
nobu c4e832bf6f configure.ac: fix build_os name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-18 06:13:10 +00:00
nobu 3859b77be1 configure.ac: use MINIRUBY as BOOTSTRAPRUBY on msys
Msys shell may not be able to run a command with a drive letter?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-18 05:14:59 +00:00
nobu 3c55a0b942 configure.ac: use BASERUBY as BOOTSTRAPRUBY if available
MINIRUBY may not be stable enough to run btest, in developing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-18 01:55:25 +00:00
nobu 74477ec2b3 Strip warnflags
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-16 02:09:48 +00:00
nobu 923d03e10c Fixed a typo, missing `$`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-16 00:48:42 +00:00
nobu bb44d9ecf0 configure: refuse to build with jemalloc when header is missing
[ruby-core:90964] [Bug #15520]

Freom: Misty De Meo <mistydemeo@github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 14:44:11 +00:00
k0kubun ec336fb40e configure.ac: Require C99
We already added AC_PROG_CC_C99 in r66605.
This commit stops warning C99 features.

[Misc #15347] [close https://github.com/ruby/ruby/pull/2064]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 08:04:35 +00:00
k0kubun 61885c9b7c configure.ac: try to fix addr2line build failure
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian8/ruby-trunk/log/20181228T063002Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20181228T081706Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-trunk/log/20181228T063002Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20181228T063003Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos7/ruby-trunk/log/20181228T080003Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/opensuseleap/ruby-trunk/log/20181228T080002Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel_zlinux/ruby-trunk/log/20181228T063303Z.fail.html.gz
https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-trunk/log/20181228T090003Z.fail.html.gz

I suspect r66598 triggered something.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28 09:23:27 +00:00
ko1 da8830e3de fix r66599 to sucess install. please refix this patch @nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28 03:09:29 +00:00
nobu 8422725408 Moved version numbers
* Define major and minor version numbers only in the public
  include/ruby/version.h header, as the API version numbers.

* Define only teeny version number in the private version.h
  header.

* RUBY_VERSION moved to version.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28 02:12:34 +00:00
nobu 1095705c42 Check if restrict keyword is supported
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28 01:56:20 +00:00
odaira 3a5cc345f8 Native coroutine implementation for ppc64le Linux
* configure.ac: enable fiber coroutine for powerpc64le-linux

* coroutine/ppc64le/Context.S: coroutine_transfer implementation

* coroutine/ppc64le/Context.h: coroutine implementation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-10 23:22:56 +00:00
naruse 2f18a95c4e fix r66311
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-10 15:48:45 +00:00
naruse 7405bbda27 Define HAVE_STMT_AND_DECL_IN_EXPR and use it [Bug #15293]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-10 13:58:36 +00:00
ko1 3e1f06da5d fix C90 error.
* configure.ac (check broken_backtrace code): fix decl. position
  error because of `-Werror=declaration-after-statement`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-05 16:15:09 +00:00
odaira d612c44dad Enable MJIT on AIX
* configure.ac: disable using __builtin_setjmp to avoid errors when execution
  globally jumps out of JITted code. Specify -std=gnu99 to JIT compilation
  to avoid errors regarding the "restrict" keyword in the precompiled header.
  Specify -shared in addition to -Wl,-G when building shared libraries
  to make mjit_build_dir.so expose the MJIT_BUILD_DIR symbol.  Use LDR_PRELOAD
  to load mjit_build_dir.so.

* mjit_worker.c: do not specify -nodefaultlibs or -nostdlibs because on AIX
  JITted code internally refers to the memcpy function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 22:19:09 +00:00
ko1 66e9bfd4be use __builtin_setjmp on mingw64 [Bug #15348].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29 06:37:01 +00:00
shyouhei 0b899a25f5 Remove HEAP_ALIGN_LOG setting in configure.ac for OpenBSD/MirOS
The ruby setting was renamed to HEAP_PAGE_ALIGN_LOG, but the
configure.in (now configure.ac) file was not updated, so the
setting had no effect.  The configure setting is unnecessary
after OpenBSD 5.2 and MirOS has been discontinued (with the last
release being over 10 years ago), so it is better to just remove
the related configure setting.

Fix [Bug #13438]
From: Jeremy Evans <code@jeremyevans.net>



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29 06:16:31 +00:00
samuel 4b0a256e9b Enable msys2 to check build status.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24 02:31:06 +00:00
normal b009de13bf configure.ac: support 32-bit builds on x86-64 systems
Because RAM is still expensive :<

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22 08:46:44 +00:00
odaira e7d919d265 * configure.ac: On AIX, LDFLAGS must be after -L../.. in TRY_LINK,
not to refer to a system-installed libruby-static.a
  when configuring the ext libraries

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-21 22:44:24 +00:00
nobu e0cd7d65e9 configure.ac: silence `command -v` outpout
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-21 09:11:06 +00:00
nobu f1ed4b713b configure.ac: add --disable-fiber-coroutine option
* configure.ac: add --disable-fiber-coroutine option, and disable
  it on x86-mingw32 for now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-21 03:26:59 +00:00
nobu 9cda5bba1b configure.ac: gather preset variables on mingw
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-21 03:26:58 +00:00
k0kubun c6d0892fa2 configure.ac: disable native-fiber for MinGW
because it had already been SEGV-ed in pull request'S CI
https://ci.appveyor.com/project/ruby/ruby/builds/20427065/job/32oahrcd58b8ubb1
and has never worked on trunk either.

Please make sure it does not SEGVs on your MinGW environment or pull
request before enabling native fiber on MinGW.

appveyor.yml: reverted commits to make CI green with native fiber
test/excludes/_appveyor/msys2/TestArray.rb: ditto
test/excludes/_appveyor/msys2/TestEnumerable.rb: ditto
test/excludes/_appveyor/vs/TestArray.rb: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 14:40:55 +00:00
samuel 972cc2d50b Fix message result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:56 +00:00
samuel 76c6b6d14b Fix configure.ac typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:52 +00:00
samuel 0b5e1442f5 Initial support for x64-mingw32
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:44 +00:00
samuel 904af4aef2 Be even more specific, for some reason it was selecting amd64 on x64-mingw32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:35 +00:00
samuel 43d7fd0946 Limit coroutine implementations to Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:31 +00:00
samuel a2cd16e58e Expose dependency between cont.c and coroutine implementation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:17:24 +00:00
samuel 3e9beaf72b Initial effort to support 32-bit Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 10:13:59 +00:00
samuel 990ddcfccf Better support for amd64 platforms
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 09:59:14 +00:00
samuel 07a324a0f6 Native implementation of coroutines to improve performance of fibers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 09:59:10 +00:00
nobu d7d0ee1065 Check -fcf-protection
* configure.ac: Check if CFLAGS actually includes -fcf-protection
  instead of checking if the flag is valid by RUBY_TRY_CFLAGS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20 00:39:07 +00:00
k0kubun 00fac76efa configure.ac: avoid crashing MJIT with -fcf-protection
by avoiding using __builtin_longjmp, like r64983.

[Bug #15307]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 23:05:11 +00:00
k0kubun b756b25c60 ruby.c: do not surface MJIT to user
In some places, both JIT and MJIT are being used, but it could be
confusing for new comers. We're not explaining MJIT on NEWS file or release
notes as well. So we consider MJIT as an internal term of implementation
like YARV.

configure.ac: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 14:00:49 +00:00
nobu 759cfd3bcb configure.ac: rename extra_warning as extra_warnflags
Adjusted to warnflags variable.  This variable will have flags for
warnings, but not a warning itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 13:21:48 +00:00
nobu 33fed2d09a configure.ac: respect extra_warnflags if given
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 10:15:20 +00:00
shyouhei e0dba0780c -Wno-unused-value [ci skip]
Without this option clang outputs tons of warnings, which
are annoying. See https://travis-ci.org/ruby/ruby/jobs/456553420#L1817


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 03:01:55 +00:00
shyouhei 45a89c0a0d sort lines [ci skip]
... for aethetic reasons.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19 02:58:51 +00:00
kazu 51902ea5c9 Remove unused default value of MJIT_CC [ci skip]
because always set `MJIT_CC` at `: ${MJIT_CC=$CC}`

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-09 13:00:03 +00:00
nobu 9b7d8947df Clear CC_WRAPPER in other than the toplevel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 16:51:19 +00:00
nobu 61eaa5e3f2 Convert MJIT_CC to Windows path on msys too
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 14:27:27 +00:00
shyouhei 3f6a4be3a4 vm_backtrace.c: pos can be zero
(lldb) target create "./miniruby"
Current executable set to './miniruby' (x86_64).
(lldb) settings set -- target.run-args  "-e0"
(lldb) run
Process 97005 launched: './miniruby' (x86_64)
./miniruby(rb_print_backtrace+0x15) [0x10024f7d5] vm_dump.c:715
./miniruby(rb_vm_get_sourceline+0x85) [0x10024c4f5] vm_backtrace.c:43
./miniruby(rb_vm_make_binding+0x146) [0x100236976] vm.c:941
./miniruby(Init_VM+0x592) [0x100249f02] vm.c:3091
./miniruby(rb_call_inits+0xc2) [0x1000c5a72] inits.c:58
./miniruby(ruby_setup+0xcb) [0x100098c6b] eval.c:74
./miniruby(ruby_init+0x9) [0x100098c99] eval.c:91
./miniruby(main+0x4d) [0x10025ddbd] addr2line.c:246
Process 97005 stopped
* thread #1: tid = 0x639bb, 0x000000010024c4f5 miniruby`rb_vm_get_sourceline(cfp=<unavailable>) + 133 at vm_backtrace.c:44, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x000000010024c4f5 miniruby`rb_vm_get_sourceline(cfp=<unavailable>) + 133 at vm_backtrace.c:44
   41       else {
   42           /* SDR() is not possible; that causes infinite loop. */
   43           rb_print_backtrace();
-> 44           __builtin_trap();
   45       }
   46   #endif
   47       return rb_iseq_line_no(iseq, pos);
(lldb)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07 08:04:33 +00:00
nobu 92e9f61579 Fix build_os:host_os pair
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 23:50:50 +00:00
nobu 78bf275c56 Expand MJIT_CC in configure
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 12:08:54 +00:00
shyouhei 4a80c0540f adopt sanitizer API
These APIs are much like <valgrind/memcheck.h>. Use them to
fine-grain annotate the usage of our memory.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 10:06:07 +00:00
nobu 67de434219 configure.ac: insert DLDSHARED
* configure.ac (DLDSHARED): `.dylib` (created by `-dynamiclib`)
  and `.bundle` (created by `-dynamic -bundle`) on macOS are
  different.  `LIBRUBY_LDSHARED` should be the former always.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 03:32:57 +00:00
shyouhei 16f5b18b7a gc.c: move ASAN check to configure
Availability of attributes are checked in configure these days,
rather than compiler macros.  Also
__attribute__((no_address_safety_analysis)) is considered
deprecated in both GCC and Clang.  Use the current best practice
if available.  See also:

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
https://clang.llvm.org/docs/AddressSanitizer.html


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-06 02:57:28 +00:00
nobu fc8bda6ff7 Respect explicitly given MJIT_CC
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 02:57:06 +00:00
nobu c111c42ba2 MJIT_CC should not use CC_WRAPPER
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-04 12:24:03 +00:00
nobu 7d9623eb24 Makefile.in: use CC_WRAPPER
* Makefile.in (CC_WRAPPER): use the wrapper to suppress warnings
  by Apple's broken packages when linking in the toplevel
  directory.

* configure.ac (CC_WRAPPER): separate from CC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-03 23:43:17 +00:00
nobu 0f28fe2bcd configure.ac: set CC_WRAPPER by checking message
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-03 23:10:57 +00:00
ko1 0b19e15a12 rename configure option `--disable-mjit` to `--disable-mjit-support`
* configure.ac: rename configure option `--disable-mjit` to
  `--disable-mjit-support` because `--disable-mjit` is ambiguous that
  runtime MJIT default enable option or supporting MJIT features.
  `ENABLE_MJIT` is also renamed to `MJIT_SUPPORT`

* Makefile.in: catch up this fix.

* common.mk: ditto.

* test/ruby/test_jit.rb: ditto.

* win32/Makefile.sub: catch up this fix on mswin.

* tool/mkconfig.rb: fix to pass `MJIT_SUPPORT` key.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 08:00:42 +00:00
ko1 b710785f1a add disabling MJIT features option.
* configure.ac: introduce new configure option `--enable-mjit` and
  `--disable-mjit`. Default is "enable".
  `--disable-mjit` disables all of MJIT features so that `ruby --jit`
  can't enable MJIT.
  This option affect a macro `USE_MJIT`.
  This change remove `--enable/disable-install-mjit-header` option.

* Makefile.in: introduce the `ENABLE_MJIT` variable.

* common.mk: use `ENABLE_MJIT` option.

* internal.h: respect `USE_MJIT`. Same as other *.c, *.h.

* test/ruby/test_jit.rb: check `ENABLE_MJIT` key of rbconfg.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 06:53:00 +00:00
naruse 595056135f Support Mach-O on backtrace with DWARF
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 06:35:25 +00:00
k0kubun 6e11415b9c configure.ac: add --disable-install-mjit-header
and substitute INSTALL_MJIT_HEADER. This would be convenient as a workaround
for user if we found a platform that can't compile Ruby after Ruby 2.6.0 release.

common.mk: Install MJIT header only when INSTALL_MJIT_HEADER
Makefile.in: ditto
win32/Makefile.sub: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19 12:31:02 +00:00
shyouhei 88a7271de4 configure.ac: do not overwrite -std=
Set -std=gnu99 only when no such compiler flag(s) are set in any
compiler-related environment variables.  This enables users to
specify something more modern, say, -std=c11.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-18 09:21:05 +00:00
shyouhei 9ab13f3837 detect clang++
Given $CC is clang-* in this case branch the sed should
match against clang, not gcc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-15 04:05:32 +00:00
nobu 9067330c6d Pass cflags given to configure to mjit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-15 00:11:45 +00:00
nobu f2427a436f Define PRIdPTR etc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13 16:21:07 +00:00
odaira 67fcbf9328 * configure.ac: do not use __builtin_longjmp on ppc64* Linux
because it causes a segmentation fault with MJIT

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-09 20:06:36 +00:00
nobu b68f2a4bba Use cd -P
Setting PWD in the process does not let `cd` traverse symlinks in
/bin/sh on macOS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-03 06:48:35 +00:00
shyouhei 1af6418742 support --with-arch=x86_64h
Recent apple machines describe themselves being x86_64h.  That
architecture is somehow supported by their C compiler and at least
by recent clang.  However config.sub does not know that fact so
making universal binary targeting it is rejected by the program.

Why not skip the check by config.sub.  [fix GH-1971]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-03 04:49:34 +00:00
shyouhei 55702df221 move GCC version check from marshal.c to configure.ac
I think it should be done in configure


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-27 04:33:11 +00:00
nobu c61adf51a3 configure.ac: prepend the wrapper after CPP is set
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21 13:52:03 +00:00
nobu 7e9ee35fb8 Remove -Wno-parentheses flag.
[Fix GH-1958]

From: Jun Aruga <jaruga@redhat.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21 10:19:10 +00:00
nobu d00199a139 darwin-cc: hide ld warnings
* tool/darwin-cc: ld in Apple's recent Xcode warns text-based stub
  files, which are probably caused by Apple's broken package.
  hide such (and architecture deprecation) warnings during
  configuration to pass TRY_LDFLAGS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21 07:19:13 +00:00
nobu e76eebd79b Ignore Xcode linker warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-20 14:30:21 +00:00
nobu cff6bdfcba Make qsort_r() flavor detecting work if qsort_r() is a macro
On FreeBSD we're going to switch to the GNU-ish version of qsort_r().
POSIX is also considering standardizing that one. To prevent faulty
calls, we have a macro in place to throw a compiler error if a BSD-style
qsort_r() call is performed on a patched system. Such an approach tends
to be permitted by POSIX.

The configure check we have in Ruby would fail if qsort_r() is a
function macro. Add parentheses around it to prevent macro expansion and
force the declaration of a prototype.

[Fix GH-1954]

From: Ed Schouten <ed@nuxi.nl>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-13 11:00:55 +00:00
nobu f677ba8871 deduce versioned tools from CC
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-12 07:01:59 +00:00
kazu c09fc47a9f Fix a typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-09 10:51:48 +00:00
nobu 8e9a8c043e util.c: qsort_s in C11
* configure.ac: macro for C11 to use qsort_s.

* util.c (ruby_qsort): fix for C11 qsort_s.  the comparison function
  for MSVCRT qsort_s is compatible with BSD qsort_r, but not with C11
  qsort_s, in spite of its name.
  note that mingw defines __STDC_VERSION__ but uses qsort_s in MSVCRT,
  so the MSVCRT block needs to preced the C11 block.
  [ruby-core:88899] [Bug #15091]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-09 07:49:04 +00:00
nobu c8ccdbfe1e configure.ac: -fstack-protector-strong
* configure.ac: use -fstack-protector-strong if available instead of
  -fstack-protector conditionally.  [ruby-core:88788] [Misc #15053]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-02 03:49:31 +00:00
nobu 68f9d7b444 random.c: SecRandomCopyBytes
* random.c (fill_random_bytes_syscall): use SecRandomCopyBytes in
  Security framework on macOS 10.7 or later.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-31 09:56:24 +00:00
nobu 762f44cf49 configure.ac: printf prifix for int64_t
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-27 05:39:09 +00:00
normal 0a77fd04b7 thread_pthread.c: use eventfd instead of pipe on Linux
Based on r64478, any regular user creating more than 1024 pipes
on Linux will end up with tiny pipes with only a single page
capacity.  So avoid wasting user resources and use lighter
eventfd on Linux.

[ruby-core:88563] [Misc #15011]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-24 19:19:01 +00:00
nobu 1961c786aa configure.ac: LIBPATHENV on macOS
* configure.ac (LIBPATHENV): use DYLD_FALLBACK_LIBRARY_PATH instead of
  DYLD_LIBRARY_PATH on macOS, to honor runtime paths embedded in the
  binaries.  [ruby-core:88487] [Bug #14992]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-16 09:46:20 +00:00
normal 3dd6288d73 thread_pthread: use POSIX timer or thread to get rid of races
This closes race condition where GVL is uncontended and a thread
receives a signal immediately before calling the blocking
function when releasing GVL:

	1) check interrupts
	2) release GVL
	3) blocking function

If signal fires after 1) but before 3), that thread may never
wake up if GVL is uncontended

We also need to wakeup the ubf_list unconditionally on
gvl_yield; because two threads can be yielding to each other
while waiting on IO#close while waiting on threads in IO#read or
IO#gets.

[ruby-core:88360] [Misc #14937]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 21:34:24 +00:00
k0kubun 0ab6266c9d Makefile.in: drop MJIT_DLDFLAGS_NOCOMPRESS
which is obsoleted by r64331

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 11:02:37 +00:00
naruse 0efd00bf4f Re-apply wrongly reverted r64330
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 07:55:43 +00:00
naruse bcf8f79d6d support compressed debug_line
re-commit r64328
https://blogs.oracle.com/solaris/elf_section_compression-v2
https://gnu.wildebeest.org/blog/mjw/2016/01/13/elf-libelf-compressed-sections-and-elfutils/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 06:20:12 +00:00
nobu 2132fb3316 configure.ac: use linker_flag to LIBRUBY_DLDFLAGS
* configure.ac: use a feature flag `linker_flag`, than checking if the
  compiler is `GCC`.

* configure.ac: append to LIBRUBY_DLDFLAGS once after initialized with
  DLDFLAGS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 06:09:57 +00:00
naruse 843589a726 Revert "support compressed debug_line"
This reverts commit r64328

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 06:05:39 +00:00
naruse a20a2b0044 support compressed debug_line
https://blogs.oracle.com/solaris/elf_section_compression-v2
https://gnu.wildebeest.org/blog/mjw/2016/01/13/elf-libelf-compressed-sections-and-elfutils/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13 02:56:06 +00:00
k0kubun 25c79f446d configure.ac: use the correct argument
for --compress-debug-sections. I thought "no" is the correct one because
configure.ac has `AS_IF([test "x$compress_debug_sections" != xno]`, but
it wasn't the case.

This commit is needed to resolve errors like:
/usr/bin/x86_64-linux-gnu-ld: invalid --compress-debug-sections option: `no'
collect2: error: ld returned 1 exit status

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12 15:16:00 +00:00
k0kubun 422f4e3e1b configure.ac: MJIT_DLDFLAGS_NOCOMPRESS
is configured now, to force -Wl,--compress-debug-sections=no
for MJIT only when the option is used in MJIT_DLDFLAGS.

This needs to be done in configure.ac to resolve build failure like
https://travis-ci.org/ruby/ruby/builds/415120662.

Makefile.in: define it in mjit_config.h

mjit_worker.c: replace hard-coded flag to MJIT_DLDFLAGS_NOCOMPRESS

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-12 15:13:06 +00:00
nobu 8b46df7947 upgrade the default WINNT version
* configure.ac: set the default target Windows NT version to 0x0600,
  as well as mswin version since r50051.  Windows XP has ended years
  ago.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-11 13:28:40 +00:00
normal 44fc3d08eb unrevert r63852 but keep SIGCHLD path disabled for win32
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...)
on that platform will never conflict with mjit use of waitpid.

In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h
so it can be easy for Linux/BSD users to test (hopefully!)
win32-compatible code.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05 03:02:33 +00:00
naruse df4a126d65 Revert r63758 and related commits
The change is unstable on Windows. Please re-commit it when it correctly
supports Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-04 15:08:56 +00:00
nobu ef01bbcf70 configure.ac: [DOC] refine help messages
cflags, cppflags, and cxxflags are additional flags to auto
configured flags, and ignored when the their respective autoconf
default variables are given.
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-03 00:49:32 +00:00
nobu 7b230cfe28 use sigsetjmp on macOS
SIGCHLD is used internally since r63758, the signal masks need to
be restored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-30 11:56:54 +00:00
normal 054a412d54 hijack SIGCHLD handler for internal use
Use a global SIGCHLD handler to guard all callers of rb_waitpid.
To work safely with multi-threaded programs, we introduce a
VM-wide waitpid_lock to be acquired BEFORE fork/vfork spawns the
process.  This is to be combined with the new ruby_waitpid_locked
function used by mjit.c in a non-Ruby thread.

Ruby-level SIGCHLD handlers registered with Signal.trap(:CHLD)
continues to work as before and there should be no regressions
in any existing use cases.

Splitting the wait queues for PID > 0 and groups (PID <= 0)
ensures we favor PID > 0 callers.

The disabling of SIGCHLD in rb_f_system is longer necessary,
as we use deferred signal handling and no longer make ANY
blocking waitpid syscalls in other threads which could "beat"
the waitpid call made by rb_f_system.

We prevent SIGCHLD from firing in normal Ruby Threads and only
enable it in the timer-thread, to prevent spurious wakeups
from in test/-ext-/gvl/test_last_thread.rb with MJIT enabled.

I've tried to guard as much of the code for RUBY_SIGCHLD==0
using C "if" statements rather than CPP "#if" so to reduce
the likelyhood of portability problems as the compiler will
see more code.

We also work to suppress false-positives from
Process.wait(-1, Process::WNOHANG) to quiets warnings from
spec/ruby/core/process/wait2_spec.rb with MJIT enabled.

Lastly, we must implement rb_grantpt for ext/pty.  We need a
MJIT-compatible way of supporting grantpt(3) which may spawn
the `pt_chown' binary and call waitpid(2) on it.

[ruby-core:87605] [Ruby trunk Bug#14867]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27 03:14:30 +00:00
nobu 64a189d207 remove DISABLE_RUBYGEMS from config files
* configure.ac: removed DISABLE_RUBYGEMS macro from config.h, not
  to rebuild everything when the flag changed.

* configure.ac, win32/configure.bat: make USE_RUBYGEMS lowercase.

* tool/mkconfig.rb: remove RUBYGEMS stuff from rbconfig.rb, not to
  reconfigure and rebuild all extension libraries.

* Makefile.in (CPPFLAGS): enable/disable Rubygems by USE_RUBYGEMS.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-22 04:13:02 +00:00
nobu a03ea378e7 prefer clock_gettime
* configure.ac: clock_gettime or gettimeofday must exist.

* process.c (rb_clock_gettime): prefer clock_gettime over
  gettimeofday, as the latter is obsolete in SUSv4.

* random.c (fill_random_seed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-14 13:10:25 +00:00
ngoto a667fe79ea configure.ac: move the checks of _XOPEN_SOURCE on Solaris
* configure.ac (solaris*): Move the checks of _XOPEN_SOURCE to the
  location before r63443, to cover non-GCC compilers on Solaris.
  This partly reverts r63443.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-16 11:06:30 +00:00
ngoto 88cb22e979 configure.ac: move checks of -std=gnu99 and _XOPEN_SOURCE on Solaris
* configure.ac (ansi_options): On Solaris, "-std=gnu99" should be
  appended to CPPFLAGS instead of warnflags and strict_warnflags,
  because the flag affects existance of functions and macros.

* configure.ac (solaris*): Check _XOPEN_SOURCE just after checking
  "-std=gnu99" on Solaris. Because _XOPEN_SOURCE also affects existance
  of many functions and macros, it is good to define it earlier.
  The check is simplified to use AC_TRY_COMPILE with RUBY_WERROR_FLAG.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-16 04:11:20 +00:00
ngoto 52b29a3314 configure.ac: revert r63438
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-16 03:57:50 +00:00
ngoto 577002efac Change logic to check _XOPEN_SOURCE on Solaris
* configure.ac: Change logic to check _XOPEN_SOURCE on Solaris.
  With _XOPEN_SOURCE, "-std=gnu99" may also be added to CPPFLAGS.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 20:48:23 +00:00
nobu f50051ad5f configure.ac: maybe with jemalloc
* configure.ac (--with-jemalloc): accept `maybe` (other than `yes`
  and `no`), check for jemalloc and use it if possible.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 08:08:24 +00:00
shyouhei a95369b33d -Wno-cast-function-type
GCC 8.1+ introduced this warning in -Weverything.  It does
shed some lights on something, but rather annoying than
useful ATM.  Might be a subject to revert this option in a
future.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 04:35:58 +00:00
ngoto 3d1e34c1ce configure.ac: remove ineffective check on Solaris with GCC
* configure.ac (solaris): Remove ineffective check for -std=iso9899:1999
  on Solaris with GCC. The "-std=iso9899:1999" was replaced by
  "-std=gnu99" by the commit r54895. The check is no longer effective
  after that, and two years have passed without error reports.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-11 17:21:37 +00:00
knu de2bfd3d9c Remove the teeny part from the shared library name on macOS
This will prevent macOS users from having to rebuild all extension
libraries every time they upgrade ruby to a new teeny release.

Before:
- libruby.2.6.0.dylib
- libruby.2.6.dylib -> libruby.2.6.0.dylib
- libruby.dylib -> libruby.2.6.0.dylib

After:
- libruby.2.6.dylib
- libruby.dylib -> libruby.2.6.dylib

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-29 11:15:41 +00:00
shyouhei 9930481a23 Prefer alignof() over _Alignof()
to allow C++ programs include <ruby.h>. [Bug #14668]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-09 02:40:12 +00:00
nobu c3da162596 Honor --silent option
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 08:29:51 +00:00
nobu 98e9444b5f configure.ac: string literal concatenation
* configure.ac: bail out if string literal concatenation is not
  available, as it is used everywhere now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-27 01:09:14 +00:00
nobu 2936d4b378 configure.ac: named blocks
* configure.ac: turned section block comments into named blocks.
  http://c16e.com/1603281120/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-24 14:28:45 +00:00
nobu dd543cd478 configure.ac: DLDFLAGS without arch flags
* configure.ac (DLDFLAGS): copy LDFLAGS before adding arch flags.
  multiple arch flags on universal binary make mjit_header.h
  failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 01:48:02 +00:00
nobu ec45161c51 configure.ac: fix rb_cv_gcc_compiler_cas
* configure.ac (rb_cv_gcc_compiler_cas): do not use one variable
  for multiple AC_CACHE_CHECK.  in one check, select by different
  values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 15:20:08 +00:00
nobu 999b58c1ff configure.ac: basic libs
* configure.ac: basic libraries like -lm are necessary for some
  extension libraries on some platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-14 14:07:00 +00:00
nobu 2dafe8df55 configure.ac: --disable-mathn option
* Makefile.in, win32/Makefile.sub: move CANONICALIZATION_FOR_MATHN
  from config.h which affects all extension libraries to XCFLAGS
  for the core only.

* configure.ac: added --disable-mathn option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-09 04:24:48 +00:00
nobu 3bc92b8eac mjit_config.h: MJIT_LDSHARED
* configure.in (MJIT_LDSHARED): define based on LDSHARED with
  replacing CC with MJIT_CC.

* Makefile.in, win32/Makefile.sub (mjit_config.h): instead of the
  default LDSHARED, use MJIT_LDSHARED to link mjit shared objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-03 05:09:32 +00:00
nobu bb3db69e2a configure.ac: library options to MAINLIBS
* configure.ac (MAINLIBS): moved library options for main program
  and static libruby, and append MAINLIBS to LIBRUBYARG_STATIC, as
  these libraries are not needed for linking to shared libruby.
  [ruby-core:85882] [Bug #14422]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02 01:37:53 +00:00
nobu 96cda9bb77 configure.ac: fix up r59130
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02 00:37:28 +00:00
nobu f6ff45ceb3 MJIT specific flags
Passing options to configure like as `configure MJIT_OPTFLAGS=-O
MJIT_DEBUGFLAGS=-g` overrides options to be used to compile JIT
code, separately from the default options to be used for ruby
itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-01 22:49:26 +00:00
nobu 0f0c32f24e mjit.c: no va_copy
* mjit.c (form_args): do not use va_copy, which cannot detect
  appropriate way to simulate when cross compiling.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-18 05:10:52 +00:00
nobu 673ae0e3c9 configure.ac: check clockid_t with necessary headers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-17 05:22:56 +00:00
mame 50700c4d3c thread_pthread.c: Use `getpagesize()` when `pthread_attr_getguardsize` is unavailable
This is also for emscripten.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-15 01:59:16 +00:00
mame 8df47f8c8d configure.ac: Use `pthread_create` to determine if pthread is available
Instead of `pthread_kill`.  This is because emscripten supports
`pthread_create` but not `pthread_kill`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-15 01:59:15 +00:00
nobu 4b8719c1cd MJIT header for multiarch
* configure.ac: MJIT_HEADER_INSTALL_DIR to rubyarchhdrdir to
  support multiarch.

* Makefile.in (MJIT_HEADER_INSTALL_DIR): configured by multiarch.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-08 15:19:32 +00:00