summaryrefslogtreecommitdiff
path: root/include/ruby/assert.h
Commit message (Collapse)AuthorAgeFilesLines
* sed -i 's/. They/. They/'卜部昌平2021-09-101-1/+1
| | | | | Truly editorial fix for comments. This works better with Emacs' set-justification-full function. [ci skip]
* Replace "iff" with "if and only if"Gannon McGibbon2021-01-191-1/+1
| | | | | | | iff means if and only if, but readers without that knowledge might assume this to be a spelling mistake. To me, this seems like exclusionary language that is unnecessary. Simply using "if and only if" instead should suffice.
* sync NDEBUG, RUBY_DEBUG, and RUBY_NDEBUG (#3327)卜部昌平2020-08-071-42/+166
| | | | | | - When NDEBUG is defined that shall be honoured. - When RUBY_DEBUG is defined that shall be honoured. - When both are defined and they conflict, warnings shall be rendered. - When nothing is specified, nothing shall happen.
* 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
|
* 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-261-3/+8
| | | | | | | | | | | | | | 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`.
* 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
* Removed extra stringizationNobuyoshi Nakada2020-05-121-2/+2
| | | | | Argument of RUBY_ASSERT_FAIL is already stringized message, so no more extra stringization should be applied.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-5/+5
| | | | To fix build failures.
* sed -i s/ruby3/rbimpl/g卜部昌平2020-05-111-1/+1
|
* sed -i s/RUBY3/RBIMPL/g卜部昌平2020-05-111-17/+17
| | | | | 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-111-5/+5
| | | | This shall fix compile errors.
* add #include guard hack卜部昌平2020-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-37/+82
| | | Split ruby.h
* Revert "Always evaluate the expression RUBY_ASSERT_MESG_WHEN just once"Nobuyoshi Nakada2019-08-051-1/+1
| | | | | | | It caused a significant benchmark fall. Some assertions seem to use expressions with side-effects which cannot be inlined. This reverts commit b452c03a14f943ae25338547bd680fce67399d85.
* Always evaluate the expression RUBY_ASSERT_MESG_WHEN just onceNobuyoshi Nakada2019-07-151-1/+1
|
* Enable RUBY_ASSERT_MESG_WHEN when RUBY_DEBUG is turned onNobuyoshi Nakada2019-07-151-3/+4
|
* introduce RUBY_ASSERT_ALWAYS(expr).Koichi Sasada2019-07-151-0/+1
| | | | | RUBY_ASSERT_ALWAYS(expr) ignores NDEBUG (we cannot remove this assertion).
* Introduce RUBY_DEBUG flag macroNobuyoshi Nakada2019-07-141-1/+4
| | | | | When RUBY_DEBUG is turned on, all RUBY_ASSERT() macros will be enabled regardless RUBY_NDEBUG.
* * expand tabs.git2019-07-141-3/+3
|
* Split RUBY_ASSERT and so on under include/rubyNobuyoshi Nakada2019-07-141-0/+49