Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cf-agent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
-I$(srcdir)/../libcfecompat \
-I$(srcdir)/../libcfnet \
-I$(srcdir)/../cf-check \
@CPPFLAGS@ \
$(ENTERPRISE_CPPFLAGS) \
$(OPENSSL_CPPFLAGS) \
$(PCRE2_CPPFLAGS) \
Expand All @@ -38,7 +37,8 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(PAM_CPPFLAGS)

AM_CFLAGS = \
@CFLAGS@ \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(ENTERPRISE_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(PCRE2_CFLAGS) \
Expand Down
4 changes: 2 additions & 2 deletions cf-check/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ noinst_LTLIBRARIES = libcf-check.la
AM_CPPFLAGS = -I$(srcdir)/../libntech/libutils \
-I$(srcdir)/../libntech/libcompat \
-I$(srcdir)/../libcfecompat \
@CPPFLAGS@ \
$(PCRE2_CPPFLAGS) \
$(LIBYAML_CPPFLAGS) \
$(LMDB_CPPFLAGS) \
$(OPENSSL_CPPFLAGS)

AM_CFLAGS = \
@CFLAGS@ \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(LMDB_CFLAGS) \
$(PCRE2_CFLAGS) \
$(LIBYAML_CFLAGS) \
Expand Down
2 changes: 2 additions & 0 deletions cf-execd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ AM_CPPFLAGS = \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(PCRE2_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(PTHREAD_CFLAGS) \
Expand Down
2 changes: 2 additions & 0 deletions cf-key/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ AM_CPPFLAGS = \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(PCRE2_CFLAGS) \
$(ENTERPRISE_CFLAGS)
Expand Down
4 changes: 3 additions & 1 deletion cf-monitord/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ AM_CPPFLAGS = \
$(OPENSSL_CPPFLAGS) \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = @CFLAGS@ \
AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
4 changes: 3 additions & 1 deletion cf-net/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(PCRE2_CPPFLAGS) \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = @CFLAGS@ \
AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
5 changes: 3 additions & 2 deletions cf-promises/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ AM_CPPFLAGS = \
-I$(srcdir)/../libpromises \
-I$(srcdir)/../libcfecompat \
-I$(srcdir)/../libcfnet \
@CPPFLAGS@ \
$(OPENSSL_CPPFLAGS) \
$(PCRE2_CPPFLAGS) \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = @CFLAGS@ \
AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
4 changes: 3 additions & 1 deletion cf-runagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(PCRE2_CPPFLAGS) \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = @CFLAGS@ \
AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
4 changes: 3 additions & 1 deletion cf-secret/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(PCRE2_CPPFLAGS) \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = @CFLAGS@ \
AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
2 changes: 2 additions & 0 deletions cf-serverd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(PTHREAD_CFLAGS) \
$(ENTERPRISE_CFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions cf-serverd/strlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ size_t StrList_bsearch(const StrList *sl,
{
if (sl != NULL && sl->len > 0)
{
struct string **ret =
struct string *const*ret =
bsearch(&s, sl->list, sl->len, sizeof(sl->list[0]),
(int (*)(const void *, const void *)) comparator);
struct string * const *base = &sl->list[0];
Expand Down Expand Up @@ -625,7 +625,7 @@ size_t StrList_SearchLongestPrefix(const StrList *sl,
* no reason to keep going. */
while (longer_match_possible && (s_prefix_len < s_len))
{
char *separator_at;
const char *separator_at;
if (direction_forward)
{
/* Find next separator, skipping the previous one. */
Expand Down
2 changes: 2 additions & 0 deletions cf-testd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ AM_CPPFLAGS = -I$(srcdir)/../libpromises -I$(srcdir)/../libntech/libutils \
$(ENTERPRISE_CPPFLAGS)

AM_CFLAGS = \
$(CF3_CFLAGS) \
$(DEBUG_CFLAGS) \
$(OPENSSL_CFLAGS) \
$(ENTERPRISE_CFLAGS)

Expand Down
2 changes: 1 addition & 1 deletion cf-testd/cf-testd.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ static char *IncrementIPaddress(const char *ip_str)
}

int step = 1;
char *last_dot = strrchr(ip_str, '.');
const char *last_dot = strrchr(ip_str, '.');
assert(last_dot != NULL); /* the doc comment says there must be dots! */
if (StringEqual(last_dot + 1, "255"))
{
Expand Down
2 changes: 2 additions & 0 deletions cf-upgrade/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ LIBS= # This tool should not link to anything
AM_LDFLAGS=
AM_CPPFLAGS=-I$(top_srcdir)/libntech/libutils # platform.h

AM_CFLAGS = $(CF3_CFLAGS) $(DEBUG_CFLAGS)

LDADD=../libntech/libcompat/libcompat.la

cf_upgrade_SOURCES = \
Expand Down
26 changes: 12 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ m4_define(incstart,sinc)
m4_define(incend,lude)

dnl
dnl Save environment CFLAGS before autoconf starts messing with it.
dnl It is restored later.
dnl Prevent AC_PROG_CC from defaulting to "-g -O2".
dnl CFLAGS is left for the user; project flags go into CF3_CFLAGS via cf3_gcc_flags.m4.
dnl
ENV_CFLAGS="$CFLAGS"
: ${CFLAGS=""}
: ${CPPFLAGS=""}

dnl ######################################################################
dnl Checks for programs.
Expand Down Expand Up @@ -286,20 +287,16 @@ AC_ARG_ENABLE(debug,
[debug=no])
AM_CONDITIONAL([NDEBUG], [test x"$debug" = x"no"])

dnl Even though CFLAGS should contain the command-line CFLAGS
dnl as last, some macro seem to messes the order up and insert
dnl its own optimisation flags as well. So we append ENV_CFLAGS
dnl at the end manually, causing a bit of flag duplication.

AC_MSG_CHECKING([for debug option])
if test x"$debug" = x"yes"
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -g3 -O0 $ENV_CFLAGS"
DEBUG_CFLAGS="-g3 -O0"
else
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS -O2 -DNDEBUG $ENV_CFLAGS"
DEBUG_CFLAGS="-O2 -DNDEBUG"
fi
AC_SUBST([DEBUG_CFLAGS])

dnl ######################################################################
dnl Checks for libraries.
Expand Down Expand Up @@ -1397,8 +1394,8 @@ dnl ######################################################################
dnl Collect all the options
dnl ######################################################################

CORE_CPPFLAGS="$LMDB_CPPFLAGS $TOKYOCABINET_CPPFLAGS $QDBM_CPPFLAGS $PCRE2_CPPFLAGS $OPENSSL_CPPFLAGS $SQLITE3_CPPFLAGS $LIBACL_CPPFLAGS $LIBCURL_CPPFLAGS $LIBRSYNC_CPPFLAGS $LIBYAML_CPPFLAGS $POSTGRESQL_CPPFLAGS $MYSQL_CPPFLAGS $LIBXML2_CPPFLAGS $CPPFLAGS $CFECOMPAT_CPPFLAGS"
CORE_CFLAGS="$LMDB_CFLAGS $TOKYOCABINET_CFLAGS $QDBM_CFLAGS $PCRE2_CFLAGS $OPENSSL_CFLAGS $SQLITE3_CFLAGS $LIBACL_CFLAGS $LIBCURL_CFLAGS $LIBRSYNC_CFLAGS $LIBYAML_CFLAGS $POSTGRESQL_CFLAGS $MYSQL_CFLAGS $LIBXML2_CFLAGS $CFLAGS"
CORE_CPPFLAGS="$LMDB_CPPFLAGS $TOKYOCABINET_CPPFLAGS $QDBM_CPPFLAGS $PCRE2_CPPFLAGS $OPENSSL_CPPFLAGS $SQLITE3_CPPFLAGS $LIBACL_CPPFLAGS $LIBCURL_CPPFLAGS $LIBRSYNC_CPPFLAGS $LIBYAML_CPPFLAGS $POSTGRESQL_CPPFLAGS $MYSQL_CPPFLAGS $LIBXML2_CPPFLAGS $CFECOMPAT_CPPFLAGS $CPPFLAGS"
Comment thread
SimonThalvorsen marked this conversation as resolved.
CORE_CFLAGS="$LMDB_CFLAGS $TOKYOCABINET_CFLAGS $QDBM_CFLAGS $PCRE2_CFLAGS $OPENSSL_CFLAGS $SQLITE3_CFLAGS $LIBACL_CFLAGS $LIBCURL_CFLAGS $LIBRSYNC_CFLAGS $LIBYAML_CFLAGS $POSTGRESQL_CFLAGS $MYSQL_CFLAGS $LIBXML2_CFLAGS $CF3_CFLAGS $DEBUG_CFLAGS"
CORE_LDFLAGS="$LMDB_LDFLAGS $TOKYOCABINET_LDFLAGS $QDBM_LDFLAGS $PCRE2_LDFLAGS $OPENSSL_LDFLAGS $SQLITE3_LDFLAGS $LIBACL_LDFLAGS $LIBCURL_LDFLAGS $LIBRSYNC_LDFLAGS $LIBYAML_LDFLAGS $POSTGRESQL_LDFLAGS $MYSQL_LDFLAGS $LIBXML2_LDFLAGS $LDFLAGS"
CORE_LIBS="$LMDB_LIBS $TOKYOCABINET_LIBS $QDBM_LIBS $PCRE2_LIBS $OPENSSL_LIBS $SQLITE3_LIBS $LIBACL_LIBS $LIBCURL_LIBS $LIBRSYNC_LIBS $LIBYAML_LIBS $POSTGRESQL_LIBS $MYSQL_LIBS $LIBXML2_LIBS $LIBS"

Expand Down Expand Up @@ -1825,11 +1822,12 @@ if test "x$use_coverage" = "xyes"; then

dnl Remove all optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
CF3_CFLAGS=`echo "$CF3_CFLAGS" | $SED -e 's/-O[0-9]*//g'`
DEBUG_CFLAGS=""
changequote([,])

dnl Add the special gcc flags
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
CF3_CFLAGS="$CF3_CFLAGS -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -lgcov"
# Need to set ENABLE_COVERAGE so that tests/unit/Makefile.am can adapt for one
# test which needs gcov stubs if core not built with coverage.
Expand Down
2 changes: 2 additions & 0 deletions ext/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@
#
bin_PROGRAMS = rpmvercmp

AM_CFLAGS = $(CF3_CFLAGS) $(DEBUG_CFLAGS)

LDADD = ../libntech/libcompat/libcompat.la
2 changes: 2 additions & 0 deletions libcfecompat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ noinst_LTLIBRARIES = libcfecompat.la

AM_CPPFLAGS = -I$(top_srcdir)/libntech/libutils # platform.h

AM_CFLAGS = $(CF3_CFLAGS) $(DEBUG_CFLAGS)

libcfecompat_la_LIBADD = $(LTLIBOBJS)

libcfecompat_la_SOURCES = \
Expand Down
2 changes: 2 additions & 0 deletions libcfnet/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/libntech/libutils \
$(LIBRSYNC_CPPFLAGS) \
$(OPENSSL_CPPFLAGS)

AM_CFLAGS = $(CF3_CFLAGS) $(DEBUG_CFLAGS)

libcfnet_la_SOURCES = \
addr_lib.c addr_lib.h \
client_protocol.c client_protocol.h cfnet.h\
Expand Down
2 changes: 2 additions & 0 deletions libenv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ AM_CPPFLAGS += $(PCRE2_CPPFLAGS)
AM_CPPFLAGS += -I$(top_srcdir)/libcfnet
AM_CPPFLAGS += -I$(top_srcdir)/libpromises

AM_CFLAGS = $(CF3_CFLAGS) $(DEBUG_CFLAGS)

CLEANFILES = *.gcno *.gcda

#
Expand Down
2 changes: 1 addition & 1 deletion libenv/sysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void CalculateDomainName(const char *nodename, const char *dnsname,
{
/* If hostname is qualified */

char *p = strchr(nodename, '.');
const char *p = strchr(nodename, '.');

if (p != NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion libpromises/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void ClassTableIteratorDestroy(ClassTableIterator *iter)

ClassRef ClassRefParse(const char *expr)
{
char *name_start = strchr(expr, ':');
const char *name_start = strchr(expr, ':');
if (!name_start)
{
return (ClassRef) { .ns = NULL, .name = xstrdup(expr) };
Expand Down
2 changes: 1 addition & 1 deletion libpromises/eval_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ bool EvalContextClassPutSoftTagsSetWithComment(EvalContext *ctx, const char *nam
{
bool ret;
char *ns = NULL;
char *delim = strchr(name, ':');
const char *delim = strchr(name, ':');

if (delim)
{
Expand Down
2 changes: 1 addition & 1 deletion libpromises/generic_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static inline bool CanSetVariable(const EvalContext *ctx, VarRef *var_ref)
static inline bool CanSetClass(const EvalContext *ctx, const char *class_spec)
{
char *ns = NULL;
char *ns_delim = strchr(class_spec, ':');
const char *ns_delim = strchr(class_spec, ':');
if (ns_delim != NULL)
{
ns = xstrndup(class_spec, ns_delim - class_spec);
Expand Down
2 changes: 1 addition & 1 deletion libpromises/keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int RemovePublicKey(const char *id)

while ((dirp = DirRead(dirh)) != NULL)
{
char *c = strstr(dirp->d_name, suffix);
const char *c = strstr(dirp->d_name, suffix);

if (c && c[strlen(suffix)] == '\0') /* dirp->d_name ends with suffix */
{
Expand Down
4 changes: 2 additions & 2 deletions libpromises/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const char *PolicyGetPolicyFileHash(const Policy *policy, const char *policy_fil

static const char *StripNamespace(const char *full_symbol)
{
char *sep = strchr(full_symbol, CF_NS);
const char *sep = strchr(full_symbol, CF_NS);

if (sep == NULL)
{
Expand Down Expand Up @@ -871,7 +871,7 @@ char *QualifiedNameNamespaceComponent(const char *qualified_name)
*/
char *QualifiedNameScopeComponent(const char *qualified_name)
{
char *sep = strchr(qualified_name, CF_NS);
const char *sep = strchr(qualified_name, CF_NS);
if (sep)
{
return xstrdup(sep + 1);
Expand Down
2 changes: 1 addition & 1 deletion libpromises/promises.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static void DereferenceAndPutComment(Promise* pp, const char *comment)
{
free(pp->comment);

char *sp;
const char *sp;
if ((sp = strstr(comment, "$(this.promiser)")) != NULL ||
(sp = strstr(comment, "${this.promiser}")) != NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions libpromises/verify_vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static bool IsLegalVariableName(EvalContext *ctx, const Promise *pp)
return false;
}

char *bracket = strchr(var_name, '[');
char *dot = strchr(var_name, '.');
const char *bracket = strchr(var_name, '[');
const char *dot = strchr(var_name, '.');
/* we only care about variable name prefix, not dots inside array keys */
if ((dot != NULL) && ((bracket == NULL) || (dot < bracket)))
{
Expand Down
Loading
Loading