mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Allow sudo to compile without variadic macro support in cpp.
Debugging support will be limited (no file info from warnings.) From Daniel Richard G.; Bug #621
This commit is contained in:
parent
96eb2c4f8f
commit
3dab6bd8e9
@ -458,6 +458,18 @@ sudo_debug_vprintf2(const char *func, const char *file, int lineno, int level,
|
||||
errno = saved_errno;
|
||||
}
|
||||
|
||||
#ifdef NO_VARIADIC_MACROS
|
||||
void
|
||||
sudo_debug_printf_nvm(int pri, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
sudo_debug_vprintf2(NULL, NULL, 0, pri, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif /* NO_VARIADIC_MACROS */
|
||||
|
||||
void
|
||||
sudo_debug_printf2(const char *func, const char *file, int lineno, int level,
|
||||
const char *fmt, ...)
|
||||
|
@ -906,6 +906,9 @@
|
||||
/* Define to 1 if you want a single ticket file instead of per-tty files. */
|
||||
#undef NO_TTY_TICKETS
|
||||
|
||||
/* Define if your C preprocessor does not support variadic macros. */
|
||||
#undef NO_VARIADIC_MACROS
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
|
16
configure
vendored
16
configure
vendored
@ -14872,7 +14872,8 @@ $as_echo "#define volatile /**/" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Check for variadic macro support in cpp
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
|
||||
$as_echo_n "checking for variadic macro support in cpp... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@ -14892,9 +14893,16 @@ sudo_fprintf(stderr, "a %s", "test");
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
|
||||
$as_echo "#define NO_VARIADIC_MACROS 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your C compiler doesn't support variadic macros, debugging support will be limited" >&5
|
||||
$as_echo "$as_me: WARNING: Your C compiler doesn't support variadic macros, debugging support will be limited" >&2;}
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
@ -16132,7 +16140,7 @@ _ACEOF
|
||||
fi
|
||||
|
||||
ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#include <sys/types.h>
|
||||
#if TIME_WITH_SYS_TIME
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
@ -2066,7 +2066,7 @@ dnl
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_C_CONST
|
||||
AC_C_VOLATILE
|
||||
# Check for variadic macro support in cpp
|
||||
AC_MSG_CHECKING([for variadic macro support in cpp])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
AC_INCLUDES_DEFAULT
|
||||
#if defined(__GNUC__) && __GNUC__ == 2
|
||||
@ -2074,7 +2074,10 @@ AC_INCLUDES_DEFAULT
|
||||
#else
|
||||
# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
|
||||
#endif
|
||||
], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
|
||||
], [sudo_fprintf(stderr, "a %s", "test");])], [AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE([NO_VARIADIC_MACROS], [1], [Define if your C preprocessor does not support variadic macros.])
|
||||
AC_MSG_WARN([Your C compiler doesn't support variadic macros, debugging support will be limited])])
|
||||
|
||||
dnl
|
||||
dnl Program checks
|
||||
|
@ -24,18 +24,11 @@
|
||||
* We wrap fatal/fatalx and warning/warningx so that the same output can
|
||||
* go to the debug file, if there is one.
|
||||
*/
|
||||
#if defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0
|
||||
# if defined(__GNUC__) && __GNUC__ == 2
|
||||
# define fatal(fmt...) fatal_nodebug(fmt)
|
||||
# define fatalx(fmt...) fatalx_nodebug(fmt)
|
||||
# define warning(fmt...) warning_nodebug(fmt)
|
||||
# define warningx(fmt...) warningx_nodebug(fmt)
|
||||
# else
|
||||
# define fatal(...) fatal_nodebug(__VA_ARGS__)
|
||||
# define fatalx(...) fatalx_nodebug(__VA_ARGS__)
|
||||
# define warning(...) warning_nodebug(__VA_ARGS__)
|
||||
# define warningx(...) warningx_nodebug(__VA_ARGS__)
|
||||
# endif /* __GNUC__ == 2 */
|
||||
#if (defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0) || defined(NO_VARIADIC_MACROS)
|
||||
# define fatal fatal_nodebug
|
||||
# define fatalx fatalx_nodebug
|
||||
# define warning warning_nodebug
|
||||
# define warningx warningx_nodebug
|
||||
# define vfatal(fmt, ap) fatal_nodebug((fmt), (ap))
|
||||
# define vfatalx(fmt, ap) fatalx_nodebug((fmt), (ap))
|
||||
# define vwarning(fmt, ap) warning_nodebug((fmt), (ap))
|
||||
|
@ -187,7 +187,9 @@
|
||||
* Variadic macros are a C99 feature but GNU cpp has supported
|
||||
* a (different) version of them for a long time.
|
||||
*/
|
||||
#if defined(__GNUC__) && __GNUC__ == 2
|
||||
#if defined(NO_VARIADIC_MACROS)
|
||||
# define sudo_debug_printf sudo_debug_printf_nvm
|
||||
#elif defined(__GNUC__) && __GNUC__ == 2
|
||||
# define sudo_debug_printf(pri, fmt...) \
|
||||
sudo_debug_printf2(__func__, __FILE__, __LINE__, (pri)|sudo_debug_subsys, \
|
||||
fmt)
|
||||
@ -218,6 +220,7 @@ void sudo_debug_exit_str_masked(const char *func, const char *file, int line, in
|
||||
void sudo_debug_exit_ptr(const char *func, const char *file, int line, int subsys, const void *rval);
|
||||
int sudo_debug_fd_set(int fd);
|
||||
int sudo_debug_init(const char *debugfile, const char *settings);
|
||||
void sudo_debug_printf_nvm(int pri, const char *fmt, ...) __printf0like(2, 3);
|
||||
void sudo_debug_printf2(const char *func, const char *file, int line, int level, const char *fmt, ...) __printf0like(5, 6);
|
||||
void sudo_debug_vprintf2(const char *func, const char *file, int line, int level, const char *fmt, va_list ap) __printf0like(5, 0);
|
||||
void sudo_debug_write(const char *str, int len, int errno_val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user