diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-14 07:59:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-14 07:59:16 +0000 |
commit | 844c04f462e0677c2723789325366f233cbd0a01 (patch) | |
tree | ee417d24bb41f269d3b43cdf82d32ba8bf4e59b5 | |
parent | fb34a2600326f6ba3ba116c35d1395e90d10fd00 (diff) |
configure.in, file.c: RUBY_FUNCTION_NAME_STRING
* configure.in (rb_cv_function_name_string): macro for function name
string predefined identifier, __func__ in C99, or __FUNCTION__ in
gcc.
* file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | file.c | 4 |
3 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,11 @@ +Thu Mar 14 16:59:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in (rb_cv_function_name_string): macro for function name + string predefined identifier, __func__ in C99, or __FUNCTION__ in + gcc. + + * file.c (rb_sys_fail_path): use RUBY_FUNCTION_NAME_STRING. + Thu Mar 14 14:12:34 2013 NARUSE, Yui <naruse@ruby-lang.org> * file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC. diff --git a/configure.in b/configure.in index 1ed1ffa267..d166664a7f 100644 --- a/configure.in +++ b/configure.in @@ -1374,6 +1374,22 @@ fi RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT) +AC_CACHE_CHECK(for function name string predefined identifier, + rb_cv_function_name_string, + [rb_cv_function_name_string=no + RUBY_WERROR_FLAG([ + for func in __func__ __FUNCTION__; do + AC_TRY_LINK([@%:@include <stdio.h>], + [puts($func);], + [rb_cv_function_name_string=$func + break]) + done + ])] +) +if test "$rb_cv_function_name_string" != no; then + AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string]) +fi + dnl Check whether we need to define sys_nerr locally AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default @%:@include <errno.h>]) @@ -102,8 +102,8 @@ int flock(int, int); #define STAT(p, s) stat((p), (s)) #endif -#ifdef __GNUC__ -# define rb_sys_fail_path(path) rb_sys_fail_path0(__func__, path) +#ifdef RUBY_FUNCTION_NAME_STRING +# define rb_sys_fail_path(path) rb_sys_fail_path0(RUBY_FUNCTION_NAME_STRING, path) NORETURN(static void rb_sys_fail_path0(const char *,VALUE)); static void rb_sys_fail_path0(const char *func_name, VALUE path) |