mruby/mruby — pull request #1440 by cremno (2013-08-07 16:31:11+00:00)
Title: Decrease size a bit (_Noreturn)

(I'm aware that mruby targets C99 and Microsoft's compiler but I also know it makes use of extensions like label as values/computed goto or enum bit-fields.)

I think ```_Noreturn``` should be used too because it decreases the size of mruby (although not much) and you don't need to edit mruby's source code to have this desirable advantage. The required changes are small.

Sadly C11 isn't widespread but extensions can be used.

I suggest a macro called ```mrb_noreturn``` should be defined under …
C11 as ```_Noreturn```
GCC/Clang (w/o ```-pedantic```) as ```__attribute__ ((noreturn))```
MS as ```__declspec(noreturn)```
otherwise it's empty.

For demonstration purposes I only added ```_Noreturn``` to the declaration of ```mrb_longjmp```, ```mrb_bug``` and ```mrb_exc_raise```:
```bash
$ clang -v
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ cat build_config_clang.rb
MRuby::Build.new { |c|
toolchain :clang
c.gembox 'default'
c.cc.flags = %w(-Os -std=gnu11 -flto)
c.linker.flags = %w(-flto)
}
```

After ```strip -s``` each executable's size in bytes was:

| executable | mirb | mrbc | mruby |
| ---------------- | ------ | ------- | --------- |
| default | 363.808 | 296.472 | 372.032 |
| noreturn | 361.280 | 294.760 | 369.456 |
| difference | 2.528 | 1.712 | 2.576 |

I'll open a pull request as soon as this suggestion is accepted.