Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit320f92b

Browse files
committed
Rely on __func__ being supported
Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99that shouldn't be necessary anymore.Solution.pm defined HAVE_FUNCNAME__FUNCTION instead ofHAVE_FUNCNAME__FUNC (originating in4164e66), as at some point in the pastMSVC only supported __FUNCTION__. Our minimum version supports __func__.Reviewed-By: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de
1 parentafe58c8 commit320f92b

File tree

9 files changed

+5
-112
lines changed

9 files changed

+5
-112
lines changed

‎config/c-compiler.m4

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -165,32 +165,6 @@ if (q != holder)
165165
fi])# PGAC_TYPE_128BIT_INT
166166

167167

168-
# PGAC_C_FUNCNAME_SUPPORT
169-
# -----------------------
170-
# Check if the C compiler understands __func__ (C99) or __FUNCTION__ (gcc).
171-
# Define HAVE_FUNCNAME__FUNC or HAVE_FUNCNAME__FUNCTION accordingly.
172-
AC_DEFUN([PGAC_C_FUNCNAME_SUPPORT],
173-
[AC_CACHE_CHECK(for__func__,pgac_cv_funcname_func_support,
174-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
175-
[printf("%s\n", __func__);])],
176-
[pgac_cv_funcname_func_support=yes],
177-
[pgac_cv_funcname_func_support=no])])
178-
if test x"$pgac_cv_funcname_func_support" = xyes ; then
179-
AC_DEFINE(HAVE_FUNCNAME__FUNC,1,
180-
[Define to 1 if your compiler understands __func__.])
181-
else
182-
AC_CACHE_CHECK(for__FUNCTION__,pgac_cv_funcname_function_support,
183-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
184-
[printf("%s\n", __FUNCTION__);])],
185-
[pgac_cv_funcname_function_support=yes],
186-
[pgac_cv_funcname_function_support=no])])
187-
if test x"$pgac_cv_funcname_function_support" = xyes ; then
188-
AC_DEFINE(HAVE_FUNCNAME__FUNCTION,1,
189-
[Define to 1 if your compiler understands __FUNCTION__.])
190-
fi
191-
fi])# PGAC_C_FUNCNAME_SUPPORT
192-
193-
194168

195169
# PGAC_C_STATIC_ASSERT
196170
# --------------------

‎configure

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14937,67 +14937,6 @@ cat >>confdefs.h <<_ACEOF
1493714937
_ACEOF
1493814938

1493914939

14940-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __func__" >&5
14941-
$as_echo_n "checking for __func__... " >&6; }
14942-
if ${pgac_cv_funcname_func_support+:} false; then :
14943-
$as_echo_n "(cached) " >&6
14944-
else
14945-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14946-
/* end confdefs.h. */
14947-
#include <stdio.h>
14948-
int
14949-
main ()
14950-
{
14951-
printf("%s\n", __func__);
14952-
;
14953-
return 0;
14954-
}
14955-
_ACEOF
14956-
if ac_fn_c_try_compile "$LINENO"; then :
14957-
pgac_cv_funcname_func_support=yes
14958-
else
14959-
pgac_cv_funcname_func_support=no
14960-
fi
14961-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14962-
fi
14963-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_funcname_func_support" >&5
14964-
$as_echo "$pgac_cv_funcname_func_support" >&6; }
14965-
if test x"$pgac_cv_funcname_func_support" = xyes ; then
14966-
14967-
$as_echo "#define HAVE_FUNCNAME__FUNC 1" >>confdefs.h
14968-
14969-
else
14970-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5
14971-
$as_echo_n "checking for __FUNCTION__... " >&6; }
14972-
if ${pgac_cv_funcname_function_support+:} false; then :
14973-
$as_echo_n "(cached) " >&6
14974-
else
14975-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14976-
/* end confdefs.h. */
14977-
#include <stdio.h>
14978-
int
14979-
main ()
14980-
{
14981-
printf("%s\n", __FUNCTION__);
14982-
;
14983-
return 0;
14984-
}
14985-
_ACEOF
14986-
if ac_fn_c_try_compile "$LINENO"; then :
14987-
pgac_cv_funcname_function_support=yes
14988-
else
14989-
pgac_cv_funcname_function_support=no
14990-
fi
14991-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14992-
fi
14993-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_funcname_function_support" >&5
14994-
$as_echo "$pgac_cv_funcname_function_support" >&6; }
14995-
if test x"$pgac_cv_funcname_function_support" = xyes ; then
14996-
14997-
$as_echo "#define HAVE_FUNCNAME__FUNCTION 1" >>confdefs.h
14998-
14999-
fi
15000-
fi
1500114940
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Static_assert" >&5
1500214941
$as_echo_n "checking for _Static_assert... " >&6; }
1500314942
if ${pgac_cv__static_assert+:} false; then :

‎configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,6 @@ m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
16351635
AC_C_BIGENDIAN
16361636
AC_C_INLINE
16371637
PGAC_PRINTF_ARCHETYPE
1638-
PGAC_C_FUNCNAME_SUPPORT
16391638
PGAC_C_STATIC_ASSERT
16401639
PGAC_C_TYPEOF
16411640
PGAC_C_TYPES_COMPATIBLE

‎src/backend/storage/lmgr/s_lock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ main()
304304
printf(" if S_LOCK() and TAS() are working.\n");
305305
fflush(stdout);
306306

307-
s_lock(&test_lock.lock,__FILE__,__LINE__,PG_FUNCNAME_MACRO);
307+
s_lock(&test_lock.lock,__FILE__,__LINE__,__func__);
308308

309309
printf("S_LOCK_TEST: failed, lock not locked\n");
310310
return1;

‎src/include/c.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,6 @@ typedef void (*pg_funcptr_t) (void);
360360
*/
361361
#defineFLEXIBLE_ARRAY_MEMBER/* empty */
362362

363-
/* Which __func__ symbol do we have, if any? */
364-
#ifdefHAVE_FUNCNAME__FUNC
365-
#definePG_FUNCNAME_MACRO__func__
366-
#else
367-
#ifdefHAVE_FUNCNAME__FUNCTION
368-
#definePG_FUNCNAME_MACRO__FUNCTION__
369-
#else
370-
#definePG_FUNCNAME_MACRONULL
371-
#endif
372-
#endif
373-
374363

375364
/* ----------------------------------------------------------------
376365
*Section 2:bool, true, false

‎src/include/pg_config.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@
158158
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
159159
#undef HAVE_FSEEKO
160160

161-
/* Define to 1 if your compiler understands __func__. */
162-
#undef HAVE_FUNCNAME__FUNC
163-
164-
/* Define to 1 if your compiler understands __FUNCTION__. */
165-
#undef HAVE_FUNCNAME__FUNCTION
166-
167161
/* Define to 1 if you have __atomic_compare_exchange_n(int *, int *, int). */
168162
#undef HAVE_GCC__ATOMIC_INT32_CAS
169163

‎src/include/storage/s_lock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ extern inttas_sema(volatile slock_t *lock);
768768

769769
#if !defined(S_LOCK)
770770
#defineS_LOCK(lock) \
771-
(TAS(lock) ? s_lock((lock), __FILE__, __LINE__,PG_FUNCNAME_MACRO) : 0)
771+
(TAS(lock) ? s_lock((lock), __FILE__, __LINE__,__func__) : 0)
772772
#endif/* S_LOCK */
773773

774774
#if !defined(S_LOCK_FREE)
@@ -855,7 +855,7 @@ init_spin_delay(SpinDelayStatus *status,
855855
status->func=func;
856856
}
857857

858-
#defineinit_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__,PG_FUNCNAME_MACRO)
858+
#defineinit_local_spin_delay(status) init_spin_delay(status, __FILE__, __LINE__,__func__)
859859
externvoidperform_spin_delay(SpinDelayStatus*status);
860860
externvoidfinish_spin_delay(SpinDelayStatus*status);
861861

‎src/include/utils/elog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
if (__builtin_constant_p(elevel) && (elevel) >= ERROR ? \
141141
errstart_cold(elevel, domain) : \
142142
errstart(elevel, domain)) \
143-
__VA_ARGS__, errfinish(__FILE__, __LINE__,PG_FUNCNAME_MACRO); \
143+
__VA_ARGS__, errfinish(__FILE__, __LINE__,__func__); \
144144
if (__builtin_constant_p(elevel) && (elevel) >= ERROR) \
145145
pg_unreachable(); \
146146
} while(0)
@@ -150,7 +150,7 @@
150150
const int elevel_ = (elevel); \
151151
pg_prevent_errno_in_scope(); \
152152
if (errstart(elevel_, domain)) \
153-
__VA_ARGS__, errfinish(__FILE__, __LINE__,PG_FUNCNAME_MACRO); \
153+
__VA_ARGS__, errfinish(__FILE__, __LINE__,__func__); \
154154
if (elevel_ >= ERROR) \
155155
pg_unreachable(); \
156156
} while(0)

‎src/tools/msvc/Solution.pm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,6 @@ sub GenerateFiles
250250
HAVE_EXECINFO_H=>undef,
251251
HAVE_EXPLICIT_BZERO=>undef,
252252
HAVE_FSEEKO=> 1,
253-
HAVE_FUNCNAME__FUNC=>undef,
254-
HAVE_FUNCNAME__FUNCTION=> 1,
255253
HAVE_GCC__ATOMIC_INT32_CAS=>undef,
256254
HAVE_GCC__ATOMIC_INT64_CAS=>undef,
257255
HAVE_GCC__SYNC_CHAR_TAS=>undef,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp