summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-06-09 16:55:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-06-09 16:55:27 +0900
commit906a86e4de71061dca0558a6bd6e0b355776dfb1 (patch)
treeba3e00a448526cc8d831d5db32f75502d8e5c9f2
parentdd8903fed72c2d06fe7a0ca6b5ef88e9140be451 (diff)
Use `dllexport` as `RUBY_FUNC_EXPORTED` on Windows
-rw-r--r--configure.ac2
-rw-r--r--parse.y5
-rw-r--r--symbol.h7
-rw-r--r--win32/Makefile.sub1
4 files changed, 10 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index f35fad6a36..ac059bf862 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1761,7 +1761,7 @@ AS_IF([test "$GCC" = yes], [
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
rb_cv_func_exported=no
RUBY_WERROR_FLAG([
-for mac in '__attribute__ ((__visibility__("default")))' '__declspec(dllexport)'; do
+for mac in '__declspec(dllexport)' '__attribute__ ((__visibility__("default")))'; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@define RUBY_FUNC_EXPORTED $mac extern
RUBY_FUNC_EXPORTED void conftest_attribute_check(void);]], [[]])],
[rb_cv_func_exported="$mac"; break])
diff --git a/parse.y b/parse.y
index 94cc1319d5..4cae4b8165 100644
--- a/parse.y
+++ b/parse.y
@@ -1568,7 +1568,7 @@ static void numparam_pop(struct parser_params *p, NODE *prev_inner);
#define CASE_LABELS_ENABLED_P(case_labels) (case_labels && case_labels != CHECK_LITERAL_WHEN)
#define yytnamerr(yyres, yystr) (YYSIZE_T)rb_yytnamerr(p, yyres, yystr)
-size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr);
+RUBY_FUNC_EXPORTED size_t rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr);
#define TOKEN2ID(tok) ( \
tTOKEN_LOCAL_BEGIN<(tok)&&(tok)<tTOKEN_LOCAL_END ? TOKEN2LOCALID(tok) : \
@@ -8613,7 +8613,6 @@ flush_string_content(struct parser_params *p, rb_encoding *enc)
dispatch_scan_event(p, tSTRING_CONTENT);
}
-RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
/* this can be shared with ripper, since it's independent from struct
* parser_params. */
#ifndef RIPPER
@@ -15935,7 +15934,7 @@ count_char(const char *str, int c)
*
* "\"`class' keyword\"" => "`class' keyword"
*/
-RUBY_FUNC_EXPORTED size_t
+size_t
rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
{
if (*yystr == '"') {
diff --git a/symbol.h b/symbol.h
index 3649f125bf..6b51868961 100644
--- a/symbol.h
+++ b/symbol.h
@@ -100,7 +100,12 @@ sym_type(VALUE sym)
#define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
#define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
-RUBY_FUNC_EXPORTED const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
+#ifndef RIPPER
+RUBY_FUNC_EXPORTED
+#else
+RUBY_EXTERN
+#endif
+const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
static inline int
is_global_name_punct(const int c)
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 55a489aaf4..c73a8a4ba5 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -746,6 +746,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define RBIMPL_ATTR_PACKED_STRUCT_END() __pragma(pack(pop))
!endif
#define RUBY_EXTERN extern __declspec(dllimport)
+#define RUBY_FUNC_EXPORTED extern __declspec(dllexport)
#define RUBY_ALIGNAS(n) __declspec(align(n))
#define RUBY_ALIGNOF __alignof
#define HAVE_DECL_SYS_NERR 1