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) "`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