Project

General

Profile

Actions

Bug #18616

closed

Error with clang(1) on MacOS due to __declspec()

Added by alx (Alejandro Colomar) over 2 years ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-darwin20]
[ruby-core:107797]

Description

Issue originally reported in Nginx Unit https://github.com/nginx/unit/issues/653.

Apple version of clang(1) behaves different than what we have in Debian
(and presumably other Linux systems).
It reports 1 for __has_declspec_attribute(noreturn) (in Debian it evaluates to 0),
without specifying -fdeclspec,
but then ruby triggers a build error due to not having specified -fdeclspec.

Not sure if that's a ruby bug or a clang bug.

$ cat ruby.c
#include <ruby.h>

int main(void)
{
	printf("RBIMPL_COMPILER_IS_MSVC: %i\n", RBIMPL_COMPILER_IS_MSVC);
	return 0;
}
$ cc -I /usr/local/opt/ruby/include/ruby-3.1.0/ -I /usr/local/opt/ruby/include/ruby-3.1.0/x86_64-darwin20/ -fdeclspec ruby.c
$ cc -I /usr/local/opt/ruby/include/ruby-3.1.0/ -I /usr/local/opt/ruby/include/ruby-3.1.0/x86_64-darwin20/ ruby.c
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:25:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/defines.h:73:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/backward/2/attributes.h:42:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/pure.h:25:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/assert.h:132:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:26:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/anyargs.h:77:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/intern/vm.h:383:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/int.h:26:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/long.h:70:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:28:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:63:14: error: expected parameter declarator
RUBY_ALIGNAS(SIZEOF_VALUE)
             ^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value.h:106:23: note: expanded from macro 'SIZEOF_VALUE'
# define SIZEOF_VALUE SIZEOF_LONG
                      ^
/usr/local/opt/ruby/include/ruby-3.1.0/x86_64-darwin20/ruby/config.h:66:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
                    ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:28:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:63:14: error: expected ')'
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value.h:106:23: note: expanded from macro 'SIZEOF_VALUE'
# define SIZEOF_VALUE SIZEOF_LONG
                      ^
/usr/local/opt/ruby/include/ruby-3.1.0/x86_64-darwin20/ruby/config.h:66:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
                    ^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:63:1: note: to match this '('
RUBY_ALIGNAS(SIZEOF_VALUE)
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/backward/2/stdalign.h:27:22: note: expanded from macro 'RUBY_ALIGNAS'
#define RUBY_ALIGNAS RBIMPL_ALIGNAS /**< @copydoc RBIMPL_ALIGNAS */
                     ^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/stdalign.h:66:44: note: expanded from macro 'RBIMPL_ALIGNAS'
# define RBIMPL_ALIGNAS(_) __declspec(align(_))
                                           ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:28:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:64:1: error: expected function body after function declarator
RBasic {
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:155:23: error: incomplete definition of type 'struct RBasic'
    return RBASIC(obj)->klass;
           ~~~~~~~~~~~^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:155:12: note: forward declaration of 'struct RBasic'
    return RBASIC(obj)->klass;
           ^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rbasic.h:40:57: note: expanded from macro 'RBASIC'
#define RBASIC(obj)                 RBIMPL_CAST((struct RBasic *)(obj))
                                                        ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:86:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:103:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:118:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:139:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:151:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:176:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:187:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:204:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:216:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:236:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:248:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
In file included from ruby.c:1:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/ruby.h:27:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic.h:23:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/arithmetic/char.h:29:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/core/rstring.h:30:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/fl_type.h:38:
In file included from /usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/value_type.h:33:
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/error.h:287:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/usr/local/opt/ruby/include/ruby-3.1.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ cc --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Updated by shyouhei (Shyouhei Urabe) over 2 years ago

Thank you for reporting! Are you using the compiler that nginx detects here? If you use one that the ruby's build system finds, then it should have added -fdeclspec into CFLAGS for you.

https://github.com/ruby/ruby/blob/cd9a9bdfc57bd5e3f5378345720e3c6aa45fdc3d/configure.ac#L614

Maybe you want to do the same thing.

Updated by alx (Alejandro Colomar) over 2 years ago

shyouhei (Shyouhei Urabe) wrote in #note-2:

Thank you for reporting! Are you using the compiler that nginx detects here? If you use one that the ruby's build system finds, then it should have added -fdeclspec into CFLAGS for you.

I was using what nginx detects.

https://github.com/ruby/ruby/blob/cd9a9bdfc57bd5e3f5378345720e3c6aa45fdc3d/configure.ac#L614

Maybe you want to do the same thing.

Ahh, I tracked it to when it was added to ruby,
and it seems it was added to ruby as a workaround for the clang(1) bug:
https://github.com/ruby/ruby/commit/0958e19ffb047781fe1506760c7cbd8d7fe74e57.

Thanks, I'll use it as a workaround, and will try to find a fix for clang(1).

Cheers,

Alex

Actions #4

Updated by alx (Alejandro Colomar) over 2 years ago

  • Subject changed from Warning with clang(1) on MacOS due to __declspec() to Error with clang(1) on MacOS due to __declspec()
Actions #5

Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0