aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* RUBY_ASSERT_NOASSUMEKoichi Sasada2020-05-291-1/+1
| | | | | | | | | If __builtin_assume() is enables and RUBY_DEBUG=0, RUBY_ASSERT(expr) will be compiled to __builtin_assume(expr) and compiler can assume expr is true and apply aggressive optimizations. However we observed doubtful behavior because of compiler optimizations, we introduce new macro RUBY_ASSERT_NOASSUME to disable __builtin_assume(). With this macro, we can try without __builtin_assume().
* Removed a trailing space [ci skip]Nobuyoshi Nakada2020-05-271-1/+1
|
* Get rid of redefinition of memcpy on mingwNobuyoshi Nakada2020-05-261-0/+2
|
* Update include/ruby/assert.hKoichi Sasada2020-05-261-1/+7
| | | Co-authored-by: 卜部昌平 <shyouhei@ruby-lang.org>
* Use RUBY_DEBUG instead of NDEBUGKoichi Sasada2020-05-2618-74/+79
| | | | | | | | | | | | | | Assertions in header files slows down an interpreter, so they should be turned off by default (simple `make`). To enable them, define a macro `RUBY_DEBUG=1` (e.g. `make cppflags=-DRUBY_DEBUG` or use `#define` at the very beggining of the file. Note that even if `NDEBUG=1` is defined, `RUBY_DEBUG=1` enables all assertions. [Feature #16837] related: https://github.com/ruby/ruby/pull/3120 `assert()` lines in MRI *.c is not disabled even if `RUBY_DEBUG=0` and it can be disabled with `NDEBUG=1`. So please consider to use `RUBY_ASSERT()` if you want to disable them when `RUBY_DEBUG=0`.
* RBIMPL_ATTR_DEPRECATED: disable for GCC10卜部昌平2020-05-251-0/+4
| | | | GCC 10.x seems buggy here. See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95302
* Added UNREACHABLE_RETURNNobuyoshi Nakada2020-05-211-0/+1
| | | | To get rid of a void function at the end of non-void function.
* rb_scan_args_set: make it slightly readable卜部昌平2020-05-211-7/+13
| | | | | This is a pure refactoring that improves understanding of what is going on. Not a big win though.
* Use __bultin_assume() from clang-7Koichi Sasada2020-05-201-1/+1
| | | | | | | We observed combination of multiple __builtin_assume() can cause strange compile results on clang-6 (-DNDEBUG exposed this issue). To avoid this problem, __builtin_assume() is from clang-7. https://github.com/ruby/ruby/pull/3120#issuecomment-630821333
* Thread scheduler for light weight concurrency.Samuel Williams2020-05-142-0/+5
|
* Removed extra stringizationNobuyoshi Nakada2020-05-122-3/+3
| | | | | Argument of RUBY_ASSERT_FAIL is already stringized message, so no more extra stringization should be applied.
* fix sunpro pragma卜部昌平2020-05-111-5/+1
| | | | | SunPro's #pragma does_not_return(...) needs an argument. That does not fit the attribute syntax we employ.
* drop varargs.h support卜部昌平2020-05-111-5/+1
| | | | | This header file is simply out of date (for decades since at least 1989). It's the 21st century. Just stop using it.
* rb_str_new: hoist RB_CONSTANT_P out of function卜部昌平2020-05-111-118/+82
| | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html says: > GCC never returns 1 when you call the inline function with a string > constant or ... Because rb_str_new and familiy take string constants, it was a bad idea for them to contain RB_CONSTANT_P. We should instead do so in corresponding macros. [ruby-core:98212]
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-11158-673/+673
| | | | To fix build failures.
* mv include/ruby/{impl,internal}卜部昌平2020-05-11143-0/+0
| | | | Devs do not love "impl".
* spaces in comments [ci skip]卜部昌平2020-05-114-12/+12
|
* sed -i s/ruby3/rbimpl/g卜部昌平2020-05-11156-241/+241
|
* sed -i s/RUBY3/RBIMPL/g卜部昌平2020-05-11167-2214/+2214
| | | | | Devs do not love "3". The only exception is RUBY3_KEYWORDS in parse.y, which seems unrelated to our interests.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-11158-673/+673
| | | | This shall fix compile errors.
* mv include/ruby/{3,impl}卜部昌平2020-05-11143-0/+0
| | | | Devs do not love "3".
* Classes made from Struct should have default `new` singleton method.Marc-Andre Lafortune2020-05-081-0/+1
| | | | | | | | | | | | | | | [Bug #16465] [Bug #16801] [Fix GH-2795] [Fix GH-2944] [Fix GH-3045] [Fix GH-3093] Note: Backporting shouldn't modify object.h and instead can use struct_new_kw which is basically a duplicate implementation of rb_class_new_instance_pass_kw Co-authored-by: Yusuke Endoh <mame@ruby-lang.org> Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: Adam Hess <HParker@github.com> Co-authored-by: Jose Cortinas <jacortinas@gmail.com> Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
* Get rid of -Wgnu-zero-variadic-macro-arguments errorsNobuyoshi Nakada2020-05-011-2/+2
| | | | | | As zero variadic macro argument, `rb_scan_args(argc, argv, "")` (or `"0"`), means 0-arity method and should be defined so, that case doesn't need to consider.
* Remove deprecated rb_require_safeJeremy Evans2020-04-301-1/+0
|
* More enums are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada2020-04-253-3/+3
|
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-04-213-3/+3
|
* RUBY_SPECIAL_SHIFT and RUBY_FL_USHIFT are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada2020-04-182-6/+5
|
* fix compiler error on gcc 4.x卜部昌平2020-04-162-20/+19
| | | | | | | | | | | | | | | | | | It seems gcc prior to 5 suffered from preprocessor bug. We have to provide workarounds. See https://github.com/ruby/ruby/runs/591138012 ---- Here is something interesting. According to C99, strictly speaking, the gcc behaviour was in fact legal(!) and everything else were wrong. This was not a bug of gcc, rather a bug of the ISO C Standard. This defect was reported to the committee as DR#412, and fixed accordingly. All tested compilers now conform C17's updated preprocessor description. See http://www.open-std.org/JTC1/SC22/WG14/www/docs/dr_412.htm
* Support for FreeBSD <sys/cdefs.h>卜部昌平2020-04-162-3/+24
| | | | | | | | | FreeBSD's <sys/cdefs.h> is broken. Cygwin is also affected by that. We need to avoid using them. See also: https://github.com/freebsd/freebsd/commit/d1c67819db000c02d3a9c79f3651c10aeedad1a0 https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;f=newlib/libc/include/sys/cdefs.h;h=44d6d53977e6bc82c2b1e6dbe8ae7f310b260604
* include what you use.卜部昌平2020-04-1339-4/+56
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 443389effc37308ce1a3c3a840082a344fc6af56. This reverts commit d94960f22ec2de3a3855305cb51343806d2b46c7. Inclusion of header files must be explicit. Every file shall directly include what is necessary. https://github.com/include-what-you-use/include-what-you-use says: > When every file includes what it uses, then it is possible to edit any > file and remove unused headers, without fear of accidentally breaking > the upwards dependencies of that file. It also becomes easy to > automatically track and update dependencies in the source code. Though we don't use iwyu itself, the principle quoted above is a good thing that we can agree. Now that include guards were added to every and all of the headers inside of our project this changeset does not increase compile time, at least on my machine.
* add #include guard hack卜部昌平2020-04-13179-816/+887
| | | | | | | | | | | | | | | | | | | | | | According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
* Make rb_scan_args implementations sameNobuyoshi Nakada2020-04-121-10/+12
| | | | | between rb_scan_args_set and rb_scan_args_assign + rb_scan_args_result.
* RUBY3_HAS_ATTRIBUTE: fix fallbacks卜部昌平2020-04-101-20/+20
| | | | Same as 133ae0807d661eac174b59c6e91c11a40975baea
* include/ruby/3: do not skip RUBY3_UNREACHABLE_RETURN卜部昌平2020-04-102-4/+0
| | | | | | | | | | | | | | | Revert "Revert "include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ compiler"" Revert "include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ compiler" Revert "include/ruby/3: Skip RUBY3_UNREACHABLE_RETURN for icc" Revert "include/ruby/3: Stop RUBY3_UNREACHABLE_RETURN to suppress a SunC warning" This reverts commit b965e7e05e4307e3c4b396673e63dbc493ef2f20. This reverts commit d2bb2e066b5a914283dd3ea473fc1762183af013. This reverts commit 8ab4c55e7a70f5a5bd041d93f425eeef4a47c01e. This reverts commit 78eec3cdc5ff0664b421e041f4f70a814542b914. After https://github.com/ruby/ruby/pull/3011, we no longer need these ifdef guards.
* ruby3_rstring_getmem: suppres warning卜部昌平2020-04-101-0/+8
| | | | | | | | | | | icc warns at this line. > include/ruby/3/core/rstring.h(126): warning #413: variable "retval" has an uninitialized const field > struct RString retval; > ^ This must not be a problem because uninitialized const field is not used at all. But the warnings are annoying. Let us suppress them.
* RUBY3_ASSUME: suppress warnings on icc卜部昌平2020-04-101-1/+11
| | | | | | | | | | | | icc warns side effects for RUBY3_ASSUME like this: > ./include/ruby/3/value_type.h(202): warning #2261: __assume expression with side effects discarded > RUBY3_ASSUME(RB_FLONUM_P(obj)); > ^ Which is a false positive (RB_FLONUM_P has no side effect). It seems there is no way for us to tell icc that a functin is safe inside of __assume. Just suppress the warning instead.
* RUBY3_HAS_BUILTIN: fix __builtin_unreachable卜部昌平2020-04-101-1/+1
| | | | | This macro has to be truthy, otherwise the `+0` trick above evalues RUBY3_HAS_BUILTIN(__builtin_unreachable) to be always false.
* reduce duplicate include.Koichi Sasada2020-04-1040-56/+9
| | | | | | | Without this patch, 20k files are opened (openat syscall) because of duplicate includes. This patch reduced it to 3k and build time was reduced compile time of range.o from 15sec -> 3sec on my machine. [Bug #16772]
* Revert "include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ ↵Yusuke Endoh2020-04-091-2/+2
| | | | | | | | | | | | | | | | | | compiler" This reverts commit d2bb2e066b5a914283dd3ea473fc1762183af013. It didn't work: https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200409T050004Z.log.html.gz#end ``` In file included from ../../.././include/ruby/3/core.h(32), from ../../.././include/ruby/ruby.h(28), from ../../.././include/ruby.h(33), from init.c(1): ../../.././include/ruby/3/core/rtypeddata.h(164): warning #967: conversion from "int" to "const struct rb_data_type_struct *"; sizes do not match RUBY3_UNREACHABLE_RETURN(0); ```
* include/ruby/3/core/rtypeddata.h: Use 0 instead of NULL for C++ compilerYusuke Endoh2020-04-091-2/+2
| | | | NULL in C++ is esoteric
* include/ruby/3: Skip RUBY3_UNREACHABLE_RETURN for iccYusuke Endoh2020-04-092-2/+2
| | | | | | | | | | | | | I'm unsure why, but it fails on icc. https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200408T220004Z.log.html.gz ``` In file included from ../../.././include/ruby/3/core.h(32), from ../../.././include/ruby/ruby.h(28), from cxxanyargs.cpp(1): ../../.././include/ruby/3/core/rtypeddata.h(163): error: return value type does not match the function type RUBY3_UNREACHABLE_RETURN(NULL); ```
* include/ruby/3: Stop RUBY3_UNREACHABLE_RETURN to suppress a SunC warningYusuke Endoh2020-04-092-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't find how to suppress a false positive "unreachable" warning of the Sun compiler: ``` "./include/ruby/3/core/rtypeddata.h", line 163: warning: statement not reached "./include/ruby/3/memory.h", line 256: warning: statement not reached ``` This warnings make mkmf test fail: https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-sunc/ruby-master/log/20200408T170004Z.fail.html.gz ``` 1) Failure: TestMkmf::TestConvertible#test_typeof_builtin [/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/test/mkmf/test_convertible.rb:9]: convertible_int: checking for convertible type of short... -------------------- short -------------------- convertible_int: checking for convertible type of int... -------------------- int -------------------- convertible_int: checking for convertible type of long... -------------------- long -------------------- convertible_int: checking for convertible type of signed short... -------------------- failed ... "cc -I. -I/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/.ext/include/sparc-solaris2.10 -I/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include -I./test -I/opt/csw/include -D_XOPEN_SOURCE=600 -DFFI_NO_RAW_API -g -c conftest.c" "/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include/ruby/3/core/rtypeddata.h", line 163: warning: statement not reached "/export/home/users/chkbuild/cb-sunc/tmp/build/20200408T170004Z/ruby/include/ruby/3/memory.h", line 256: warning: statement not reached checked program was: /* begin */ 1: #include "ruby.h" 2: 3: typedef signed short rbcv_typedef_; 4: 5: extern rbcv_typedef_ foo(); 6: extern short foo(); /* end */ ```
* RARRAY_EMBED_LEN/RSTRING_EMBED_LEN: add RUBY3_CAST卜部昌平2020-04-082-2/+2
| | | | | | RUBY3_CAST is a macro to suppress g++/clang++ warnings about C-style casts. Though Ruby core don't have to bother C++ situations, extension libraries can benefit from this.
* RUBY3_HAS_BUILTIN: icc has broken __has_builtin卜部昌平2020-04-081-1/+4
| | | | | It turned out that compilation errors in icc were due to their having broken __has_builtin. Let's just skip such situations.
* Suppress C4244 "possible loss of data" warningsNobuyoshi Nakada2020-04-082-2/+2
|
* RUBY3_HAS_BUILTIN: fix for nonexistent builtin卜部昌平2020-04-081-1/+1
| | | | | | | | | Trying to fix icc breakage: https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20200408T050004Z.fail.html.gz It seems the macro had problems when a builtin does not exist for the target compiler. Force evaluete to 0 then, by adding 0 to the expression.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-08171-4513/+12606
| | | Split ruby.h
* fix typo in documentationDerek Argueta2020-04-061-1/+1
|
* Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada2020-03-211-6/+0
|
* Fix typos (#2958)K.Takata2020-03-111-1/+1
| | | | | * Fix a typo * Fix typos in st.[ch]