Project

General

Profile

Actions

Bug #11426

closed

moving RClass does shows warning even if RClass itself is not used

Added by Hanmac (Hans Mackowiak) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-08-10 trunk 51517) [x86_64-linux]
[ruby-core:70297]

Description

i got the following warning when i want to build my binding with using ruby from trunk

/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/ruby/ruby.h:827:16: warning: attribute ignored in declaration of ‘struct RClassDeprecated’ [-Wattributes]
 #define RClass RClassDeprecated
                ^
/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/x86_64-linux/ruby/config.h:127:67: note: in definition of macro ‘DEPRECATED_TYPE’
 #define DEPRECATED_TYPE(mesg,x) __attribute__ ((deprecated mesg)) x
                                                                   ^
/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/ruby/ruby.h:829:8: note: in expansion of macro ‘RClass’
 struct RClass {
        ^
/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/ruby/ruby.h:827:16: note: attribute for ‘struct RClassDeprecated’ must follow the ‘struct’ keyword
 #define RClass RClassDeprecated
                ^
/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/x86_64-linux/ruby/config.h:127:67: note: in definition of macro ‘DEPRECATED_TYPE’
 #define DEPRECATED_TYPE(mesg,x) __attribute__ ((deprecated mesg)) x
                                                                   ^
/usr/local/rvm/rubies/ruby-head/include/ruby-2.3.0/ruby/ruby.h:829:8: note: in expansion of macro ‘RClass’
 struct RClass {
        ^

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

What version of gcc?

Updated by Hanmac (Hans Mackowiak) over 8 years ago

"gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)" shipped with Ubuntu

EDIT: i fixed the warning with doing this:

#define RClass RClassDeprecated
struct DEPRECATED_TYPE(("RClass is internal use only"),
RClass {
struct RBasic basic;
});

but i am unsure for what #define RClass RClassDeprecated is for, because there is no RClassDeprecated ...

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

I've misread as that the warnings are shown when compiling ruby.
What's your binding?
Please explain exact steps to reproduce.

Actions #4

Updated by Hanmac (Hans Mackowiak) over 8 years ago

i am building this:
https://github.com/Hanmac/rwx

the error happen when i do:

cd ext
ruby extconf.rb (there are already the warnings in the mkmf.log)

and when i do

make

then the warning does appear for each object file it builds.

Actions #5

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

OK, g++ does reject __attribute__ between struct and a name, while gcc allows.

$ cat a.c
__attribute__((deprecated)) struct a;
$ gcc -c a.c
$ g++ -c a.c
a.c:1:36: warning: attribute ignored in declaration of 'struct a' [-Wattributes]
 __attribute__((deprecated)) struct a;
                                    ^
a.c:1:36: note: attribute for 'struct a' must follow the 'struct' keyword
Actions #6

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Feedback to Closed

Applied in changeset r51621.


ruby.h: adjust for g++

  • include/ruby/ruby.h (RClass): move __attribute__ after the
    keyword struct for g++. [ruby-core:70297] [Bug #11426]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0