Skip to content

Commit 8ecdefc

Browse files
committed
Remove test for VA_ARGS, implied by C99.
This simplifies logic / reduces duplication in a few headers. Author: Andres Freund Discussion: https://postgr.es/m/97d4b165-192d-3605-749c-f614a0c4e783@2ndquadrant.com
1 parent cb92520 commit 8ecdefc

File tree

7 files changed

+1
-69
lines changed

7 files changed

+1
-69
lines changed

config/c-compiler.m4

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -415,25 +415,6 @@ fi])# PGAC_C_COMPUTED_GOTO
415415

416416

417417

418-
# PGAC_C_VA_ARGS
419-
# --------------
420-
# Check if the C compiler understands C99-style variadic macros,
421-
# and define HAVE__VA_ARGS if so.
422-
AC_DEFUN([PGAC_C_VA_ARGS],
423-
[AC_CACHE_CHECK(for __VA_ARGS__, pgac_cv__va_args,
424-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
425-
[#define debug(...) fprintf(stderr, __VA_ARGS__)
426-
debug("%s", "blarg");
427-
])],
428-
[pgac_cv__va_args=yes],
429-
[pgac_cv__va_args=no])])
430-
if test x"$pgac_cv__va_args" = xyes ; then
431-
AC_DEFINE(HAVE__VA_ARGS, 1,
432-
[Define to 1 if your compiler understands __VA_ARGS__ in macros.])
433-
fi])# PGAC_C_VA_ARGS
434-
435-
436-
437418
# PGAC_PROG_VARCC_VARFLAGS_OPT
438419
# -----------------------
439420
# Given a compiler, variable name and a string, check if the compiler

configure

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13973,38 +13973,6 @@ if test x"$pgac_cv_computed_goto" = xyes ; then
1397313973

1397413974
$as_echo "#define HAVE_COMPUTED_GOTO 1" >>confdefs.h
1397513975

13976-
fi
13977-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __VA_ARGS__" >&5
13978-
$as_echo_n "checking for __VA_ARGS__... " >&6; }
13979-
if ${pgac_cv__va_args+:} false; then :
13980-
$as_echo_n "(cached) " >&6
13981-
else
13982-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13983-
/* end confdefs.h. */
13984-
#include <stdio.h>
13985-
int
13986-
main ()
13987-
{
13988-
#define debug(...) fprintf(stderr, __VA_ARGS__)
13989-
debug("%s", "blarg");
13990-
13991-
;
13992-
return 0;
13993-
}
13994-
_ACEOF
13995-
if ac_fn_c_try_compile "$LINENO"; then :
13996-
pgac_cv__va_args=yes
13997-
else
13998-
pgac_cv__va_args=no
13999-
fi
14000-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14001-
fi
14002-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__va_args" >&5
14003-
$as_echo "$pgac_cv__va_args" >&6; }
14004-
if test x"$pgac_cv__va_args" = xyes ; then
14005-
14006-
$as_echo "#define HAVE__VA_ARGS 1" >>confdefs.h
14007-
1400813976
fi
1400913977
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
1401013978
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }

configure.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,6 @@ PGAC_C_BUILTIN_BSWAP64
14341434
PGAC_C_BUILTIN_CONSTANT_P
14351435
PGAC_C_BUILTIN_UNREACHABLE
14361436
PGAC_C_COMPUTED_GOTO
1437-
PGAC_C_VA_ARGS
14381437
PGAC_STRUCT_TIMEZONE
14391438
PGAC_UNION_SEMUN
14401439
PGAC_STRUCT_SOCKADDR_UN

src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,6 @@
758758
/* Define to 1 if your compiler understands _Static_assert. */
759759
#undef HAVE__STATIC_ASSERT
760760

761-
/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
762-
#undef HAVE__VA_ARGS
763-
764761
/* Define to 1 if you have the `__strtoll' function. */
765762
#undef HAVE___STRTOLL
766763

src/include/pg_config.h.win32

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,6 @@
601601
/* Define to 1 if your compiler understands _Static_assert. */
602602
/* #undef HAVE__STATIC_ASSERT */
603603

604-
/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
605-
#define HAVE__VA_ARGS 1
606-
607604
/* Define to the appropriate printf length modifier for 64-bit ints. */
608605
#define INT64_MODIFIER "ll"
609606

src/include/utils/elog.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,8 @@ extern int getinternalerrposition(void);
207207
* elog(ERROR, "portal \"%s\" not found", stmt->portalname);
208208
*----------
209209
*/
210-
#ifdef HAVE__VA_ARGS
211210
/*
212-
* If we have variadic macros, we can give the compiler a hint about the
211+
* Using variadic macros, we can give the compiler a hint about the
213212
* call not returning when elevel >= ERROR. See comments for ereport().
214213
* Note that historically elog() has called elog_start (which saves errno)
215214
* before evaluating "elevel", so we preserve that behavior here.
@@ -236,11 +235,6 @@ extern int getinternalerrposition(void);
236235
} \
237236
} while(0)
238237
#endif /* HAVE__BUILTIN_CONSTANT_P */
239-
#else /* !HAVE__VA_ARGS */
240-
#define elog \
241-
elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO), \
242-
elog_finish
243-
#endif /* HAVE__VA_ARGS */
244238

245239
extern void elog_start(const char *filename, int lineno, const char *funcname);
246240
extern void elog_finish(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);

src/pl/plpython/plpy_elog.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ extern PyObject *PLy_exc_spi_error;
1515
*
1616
* See comments at elog() about the compiler hinting.
1717
*/
18-
#ifdef HAVE__VA_ARGS
1918
#ifdef HAVE__BUILTIN_CONSTANT_P
2019
#define PLy_elog(elevel, ...) \
2120
do { \
@@ -32,9 +31,6 @@ extern PyObject *PLy_exc_spi_error;
3231
pg_unreachable(); \
3332
} while(0)
3433
#endif /* HAVE__BUILTIN_CONSTANT_P */
35-
#else /* !HAVE__VA_ARGS */
36-
#define PLy_elog PLy_elog_impl
37-
#endif /* HAVE__VA_ARGS */
3834

3935
extern void PLy_elog_impl(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);
4036

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy