ruby-changes:27702
From: nobu <ko1@a...>
Date: Thu, 14 Mar 2013 16:59:49 +0900 (JST)
Subject: [ruby-changes:27702] nobu:r39754 (trunk): configure.in, file.c: RUBY_FUNCTION_NAME_STRING
nobu 2013-03-14 16:59:16 +0900 (Thu, 14 Mar 2013) New Revision: 39754 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39754 Log: 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. Modified files: trunk/ChangeLog trunk/configure.in trunk/file.c Index: configure.in =================================================================== --- configure.in (revision 39753) +++ configure.in (revision 39754) @@ -1374,6 +1374,22 @@ fi https://github.com/ruby/ruby/blob/trunk/configure.in#L1374 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>]) Index: ChangeLog =================================================================== --- ChangeLog (revision 39753) +++ ChangeLog (revision 39754) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Mar 14 16:59:09 2013 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * file.c (rb_sys_fail_path): use rb_sys_fail_path0 only on GCC. Index: file.c =================================================================== --- file.c (revision 39753) +++ file.c (revision 39754) @@ -102,8 +102,8 @@ int flock(int, int); https://github.com/ruby/ruby/blob/trunk/file.c#L102 #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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/