[前][次][番号順一覧][スレッド一覧]

ruby-changes:64113

From: Nobuyoshi <ko1@a...>
Date: Sat, 12 Dec 2020 17:03:07 +0900 (JST)
Subject: [ruby-changes:64113] 21c5726418 (master): Omit checks for C89 standard or later

https://git.ruby-lang.org/ruby.git/commit/?id=21c5726418

From 21c5726418136d6efa98cbf205860a8bee328907 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 12 Dec 2020 16:01:10 +0900
Subject: Omit checks for C89 standard or later

Now we require C99, these features available of course.

* prototypes
* stdarg prototypes
* token pasting
* stringization
* string literal concatenation

diff --git a/configure.ac b/configure.ac
index 1ab36e8..65494b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1376,78 +1376,6 @@ RUBY_REPLACE_TYPE(clockid_t, [], CLOCKID, [@%:@ifdef HAVE_TIME_H https://github.com/ruby/ruby/blob/trunk/configure.ac#L1376
 @%:@ include <sys/time.h>
 @%:@endif])
 
-AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
-  [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
-	rb_cv_have_prototypes=yes,
-	rb_cv_have_prototypes=no)])
-AS_IF([test "$rb_cv_have_prototypes" = yes], [
-  AC_DEFINE(HAVE_PROTOTYPES)
-])
-
-AC_CACHE_CHECK(token paste string, rb_cv_tokenpaste,
-  [AC_TRY_COMPILE([@%:@define paste(a,b) a@%:@@%:@b],
-		  [int xy = 1; return paste(x,y);],
-		  rb_cv_tokenpaste=ansi,
-		  rb_cv_tokenpaste=knr)])
-AS_IF([test "$rb_cv_tokenpaste" = ansi], [
-  AC_DEFINE(TOKEN_PASTE(x,y),[x@%:@@%:@y])
-], [
-  AC_DEFINE(TOKEN_PASTE(x,y),[x/**/y])
-])
-
-AC_CACHE_CHECK(stringization, rb_cv_stringization, [
-  rb_cv_stringization=no
-  for string in "#expr" '"expr"'; do
-    AC_COMPILE_IFELSE([
-      AC_LANG_BOOL_COMPILE_TRY([
-#define STRINGIZE0(expr) $string
-#define STRINGIZE(expr) STRINGIZE0(expr)
-#undef real_test_for_stringization
-#define test_for_stringization -.real_test_for_stringization.-
-const char stringized[[]] = STRINGIZE(test_for_stringization);
-], [sizeof(stringized) == 32])],
-      [rb_cv_stringization="$string"; break],
-      [rb_cv_stringization=no])
-  done]
-)
-AC_DEFINE(STRINGIZE(expr),STRINGIZE0(expr))
-AS_IF([test x"$rb_cv_stringization" != xno -a "$rb_cv_stringization" != "#expr"], [
-  AC_DEFINE_UNQUOTED(STRINGIZE0(expr),$rb_cv_stringization)
-  AC_DEFINE(OLD_FASHIONED_STRINGIZATION,1)
-])
-
-AC_CACHE_CHECK([string literal concatenation],
-  rb_cv_string_literal_concatenation, [
-  AC_COMPILE_IFELSE([
-    AC_LANG_BOOL_COMPILE_TRY([
-const char concatenated_literal[[]] = "literals" "to"
-  "be" "concatenated.";
-], [sizeof(concatenated_literal) == 26])],
-    [rb_cv_string_literal_concatenation=yes],
-    [rb_cv_string_literal_concatenation=no])]
-)
-AS_IF([test "$rb_cv_string_literal_concatenation" = no], [
-  AC_MSG_ERROR([No string literal concatenation])
-])
-
-AC_CACHE_CHECK(for variable length prototypes and stdarg.h, rb_cv_stdarg,
-  [AC_TRY_COMPILE([
-#include <stdarg.h>
-int foo(int x, ...) {
-	va_list va;
-	va_start(va, x);
-	va_arg(va, int);
-	va_arg(va, char *);
-	va_arg(va, double);
-	return 0;
-}
-], [return foo(10, "", 3.14);],
-	rb_cv_stdarg=yes,
-	rb_cv_stdarg=no)])
-AS_IF([test "$rb_cv_stdarg" = yes], [
-  AC_DEFINE(HAVE_STDARG_PROTOTYPES)
-])
-
 # __VA_ARGS__ is also tested in AC_PROG_CC_C99 since autoconf 2.60a (around
 # 2006). The check below is redundant and should always success.  Remain not
 # deleted for backward compat.
diff --git a/include/ruby/internal/config.h b/include/ruby/internal/config.h
index 4a7a461..67d7e01 100644
--- a/include/ruby/internal/config.h
+++ b/include/ruby/internal/config.h
@@ -28,18 +28,21 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/config.h#L28
 
 #include "ruby/internal/compiler_since.h"
 
+#undef  HAVE_PROTOTYPES
+#define HAVE_PROTOTYPES 1
+
+#undef  HAVE_STDARG_PROTOTYPES
+#define HAVE_STDARG_PROTOTYPES 1
+
+#undef  TOKEN_PASTE
+#define TOKEN_PASTE(x,y) x##y
+
 #if defined(__cplusplus)
 #/* __builtin_choose_expr and __builtin_types_compatible aren't available
 # * on C++.  See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
 # undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
 # undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P
 
-# undef  HAVE_PROTOTYPES
-# define HAVE_PROTOTYPES 1
-
-# undef  HAVE_STDARG_PROTOTYPES
-# define HAVE_STDARG_PROTOTYPES 1
-
 /* HAVE_VA_ARGS_MACRO is for C.  C++ situations might be different. */
 # undef HAVE_VA_ARGS_MACRO
 # if __cplusplus >= 201103L
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 9686d1c..71565f0 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -680,9 +680,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L680
 !if $(MSC_VER) < 1400
 #define SIZE_MAX UINT_MAX
 !endif
-#define HAVE_PROTOTYPES 1
-#define TOKEN_PASTE(x,y) x##y
-#define HAVE_STDARG_PROTOTYPES 1
 !if $(MSC_VER) >= 1800
 #define HAVE_VA_COPY 1
 !else
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]