1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby
Marvin Schmidt dbeddfb0b2
Make global ruby namespace usage explicit
If the use of the ruby namespace isn't prepended by `::` to make it
explicit that the global ruby namespace is referenced here, it can
clash with other non-global namespace named ruby, e.g.

```
  // declaration
  namespace myproject {
  namespace ruby {
    // my ruby classes
  }
  }

  // implementation
  using namespace myproject;

  [...]

  rb_define_method(...);

  [...]
```

leads to the following error:

```
../ruby/choice.cc: In function 'void {anonymous}::do_register_choice()':
../ruby/choice.cc:342:9: error: reference to 'ruby' is ambiguous
  342 |         rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
      |         ^~~~~~~~~~~~~~~~
In file included from ../ruby/choice.cc:20:
../ruby/paludis_ruby.hh:53:15: note: candidates are: 'namespace paludis::ruby { }'
   53 |     namespace ruby
      |               ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/backward/2/stdalign.h:23,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/defines.h:77,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:23,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
                 from ../ruby/paludis_ruby.hh:44,
                 from ../ruby/choice.cc:20:
/usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/stdalign.h:92:11: note:                 'namespace ruby { }'
   92 | namespace ruby {
      |           ^~~~
In file included from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/internal/anyargs.h:83,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby/ruby.h:24,
                 from /usr/x86_64-pc-linux-gnu/include/ruby-3.0/ruby.h:38,
                 from ../ruby/paludis_ruby.hh:44,
                 from ../ruby/choice.cc:20:
../ruby/choice.cc:342:9: error: '::define' has not been declared
  342 |         rb_define_method(c_choices, "each", RUBY_FUNC_CAST(&choices_each), 0);
      |         ^~~~~~~~~~~~~~~~
../ruby/choice.cc:344:9: error: reference to 'ruby' is ambiguous
  344 |         rb_define_method(c_choices, "find_by_name_with_prefix", RUBY_FUNC_CAST(&choices_find_by_name_with_prefix), 1);
      |         ^~~~~~~~~~~~~~~~
```
2021-02-14 22:12:32 +09:00
..
backward Make global ruby namespace usage explicit 2021-02-14 22:12:32 +09:00
fiber Updated pre-prototype declarations 2021-02-09 17:11:14 +09:00
internal rb_clear_method_cache_by_class: no longer exist 2021-02-04 12:34:19 +09:00
assert.h Replace "iff" with "if and only if" 2021-01-19 12:06:45 -08:00
atomic.h Use RBIMPL_COMPILER_{SINCE,BEFORE} for MSVC 2020-12-24 16:22:50 +09:00
backward.h Fixed missing NORETURN on rb_mod_const_missing 2020-12-31 12:30:13 +09:00
debug.h
defines.h win32: Deprecate file CP version functions 2020-12-20 18:34:04 +09:00
encoding.h Expose the rb_interned_str_* family of functions 2020-11-17 09:39:25 +09:00
intern.h
io.h Rework console to use rb_io_wait. 2020-09-14 16:44:09 +12:00
memory_view.h [memory_view] Fix a comment 2020-12-25 20:11:01 +09:00
missing.h
onigmo.h
oniguruma.h
ractor.h expose some C-APIs for ractor 2021-01-06 16:03:09 +09:00
random.h Use opaque struct pointer than void 2020-11-27 21:38:08 +09:00
re.h
regex.h
ruby.h include/ruby/backward/2/rmodule.h: deprecate 2020-08-27 16:42:06 +09:00
st.h
subst.h
thread.h
thread_native.h fix public interface 2020-11-18 03:52:41 +09:00
util.h
version.h Development of 3.1.0 started. 2020-12-25 17:09:16 +09:00
vm.h
win32.h win32: Declared wait and fixed the return type 2020-12-27 16:49:27 +09:00