Commit 2967f01e authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

param: Add a new cc_warnings parameter

With a new %w expansion in the cc_command parameter.
parent f985e15c
......@@ -233,6 +233,7 @@ void mgt_vcl_startup(struct cli *, const char *vclsrc, const char *origin,
int mgt_push_vcls(struct cli *, unsigned *status, char **p);
const char *mgt_has_vcl(void);
extern char *mgt_cc_cmd;
extern char *mgt_cc_warn;
extern const char *mgt_vcl_path;
extern const char *mgt_vmod_path;
#define MGT_VCC(t, n, cc) extern t mgt_vcc_ ## n;
......
......@@ -63,6 +63,7 @@ struct vcc_priv {
};
char *mgt_cc_cmd;
char *mgt_cc_warn;
const char *mgt_vcl_path;
const char *mgt_vmod_path;
#define MGT_VCC(t, n, cc) t mgt_vcc_ ## n;
......@@ -150,6 +151,9 @@ run_cc(void *priv)
case 'o':
VSB_cat(sb, VGC_LIB);
break;
case 'w':
VSB_cat(sb, mgt_cc_warn);
break;
case '%':
VSB_putc(sb, '%');
break;
......
varnishtest "cc_command and cc_warnings"
varnish v1 -cliok {param.set debug +vcl_keep}
varnish v1 -cliok {param.set cc_command "! printf '%w' >world"}
varnish v1 -cliok {param.set cc_warnings hello}
varnish v1 -errvcl "VCL compilation failed" "backend be none;"
shell -expect hello "cat v1/vcl_*/world"
......@@ -806,26 +806,33 @@ else
*-*-solaris*)
case $PTHREAD_CC in
*gcc*)
VCC_CC="$PTHREAD_CC $OCFLAGS $WFLAGS $PTHREAD_CFLAGS -fpic -shared -o %o %s"
VCC_CC="$PTHREAD_CC $OCFLAGS %w $PTHREAD_CFLAGS -fpic -shared -o %o %s"
break
;;
*cc)
VCC_CC="$PTHREAD_CC $OCFLAGS $WFLAGS -errwarn=%all,no%E_STATEMENT_NOT_REACHED $PTHREAD_CFLAGS -Kpic -G -o %o %s"
VCC_CC="$PTHREAD_CC $OCFLAGS %w -errwarn=%all,no%E_STATEMENT_NOT_REACHED $PTHREAD_CFLAGS -Kpic -G -o %o %s"
;;
esac
;;
*-*-darwin*)
VCC_CC="exec cc $OCFLAGS $WFLAGS -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s"
VCC_CC="exec cc $OCFLAGS %w -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s"
;;
*)
VCC_CC="exec $PTHREAD_CC $OCFLAGS $WFLAGS $PTHREAD_CFLAGS $SAN_CFLAGS -fpic -shared -Wl,-x -o %o %s"
VCC_CC="exec $PTHREAD_CC $OCFLAGS %w $PTHREAD_CFLAGS $SAN_CFLAGS -fpic -shared -Wl,-x -o %o %s"
;;
esac
fi
if test "$ac_cv_env_VCC_WARN_set" = set; then
VCC_WARN=$ac_cv_env_VCC_WARN_value
else
VCC_WARN=$WFLAGS
fi
OCFLAGS="$OCFLAGS $WFLAGS"
AC_DEFINE_UNQUOTED([VCC_CC],"$VCC_CC",[C compiler command line for VCL code])
AC_DEFINE_UNQUOTED([VCC_WARN],"$VCC_WARN",[C compiler warnings for VCL code])
# Stupid automake needs this
VTC_TESTS="$(cd $srcdir/bin/varnishtest && echo tests/*.vtc)"
......
......@@ -1533,7 +1533,20 @@ PARAM_STRING(
"Command used for compiling the C source code to a "
"dlopen(3) loadable object. Any occurrence of %s in "
"the string will be replaced with the source file name, "
"and %o will be replaced with the output file name.",
"%o will be replaced with the output file name, and %w "
"will be replaced by the cc_warnings parameter.",
/* flags */ MUST_RELOAD
)
PARAM_STRING(
/* name */ cc_warnings,
/* tweak */ tweak_string,
/* priv */ &mgt_cc_warn,
/* def */ VCC_WARN,
/* descr */
"Warnings used when compiling the C source code with "
"the cc_command parameter. By default, VCL is compiled "
"with the same set of warnings as Varnish itself.",
/* flags */ MUST_RELOAD
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment