Merge pull request #1740 from rubenk/correct-am_cflags
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 4 Jun 2016 18:16:56 +0000 (20:16 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 4 Jun 2016 18:16:56 +0000 (20:16 +0200)
Append -Werror to the right flags

configure.ac
contrib/redhat/collectd.spec
src/chrony.c

index 7aff89a..4816c75 100644 (file)
@@ -800,12 +800,14 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr
 AC_FUNC_STRERROR_R
 
 test_cxx_flags() {
-       AC_LANG_PUSH(C++)
-       AC_LANG_CONFTEST([int main(void){}])
+       AC_LANG_PUSH([C++])
+       AC_LANG_CONFTEST([
+               AC_LANG_SOURCE([[int main(void){}]])
+       ])
        $CXX -c conftest.cpp $CXXFLAGS $@ > /dev/null 2> /dev/null
        ret=$?
        rm -f conftest.o
-       AC_LANG_POP(C++)
+       AC_LANG_POP([C++])
        return $ret
 }
 
index 072dd6b..b6d709e 100644 (file)
@@ -424,6 +424,7 @@ Requires:   %{name}%{?_isa} = %{version}-%{release}
 BuildRequires: protobuf-compiler
 %description grpc
 This plugin embeds a gRPC server into Collectd.
+%endif
 
 %if %{with_hddtemp}
 %package hddtemp
index 4554f49..2bfba2f 100644 (file)
@@ -674,7 +674,7 @@ ntohf(tFloat p_float)
 
 
 static void
-chrony_push_data(char *p_type, char *p_type_inst, double p_value)
+chrony_push_data(const char *p_type, const char *p_type_inst, double p_value)
 {
   value_t values[1];
   value_list_t vl = VALUE_LIST_INIT;
@@ -705,7 +705,7 @@ chrony_push_data(char *p_type, char *p_type_inst, double p_value)
 
 
 static void
-chrony_push_data_valid(char *p_type, char *p_type_inst, const int p_is_valid,
+chrony_push_data_valid(const char *p_type, const char *p_type_inst, const int p_is_valid,
                        double p_value)
 {
   /* Push real value if p_is_valid is true, push NAN if p_is_valid is not true (idea from ntp plugin) */
@@ -722,8 +722,10 @@ chrony_init_seq()
   /* Initialize the sequence number generator from /dev/urandom */
   /* Fallbacks: /dev/random and time(NULL) */
 
+  int fh;
+
   /* Try urandom */
-  int fh = open(URAND_DEVICE_PATH, O_RDONLY);
+  fh = open(URAND_DEVICE_PATH, O_RDONLY);
   if (fh >= 0)
   {
     ssize_t rc = read(fh, &g_chrony_rand, sizeof(g_chrony_rand));
@@ -742,7 +744,7 @@ chrony_init_seq()
     if (errno == ENOENT)
     {
       /* URAND_DEVICE_PATH device not found. Try RAND_DEVICE_PATH as fall-back */
-      int fh = open(RAND_DEVICE_PATH, O_RDONLY);
+      fh = open(RAND_DEVICE_PATH, O_RDONLY);
       if (fh >= 0)
       {
         ssize_t rc = read(fh, &g_chrony_rand, sizeof(g_chrony_rand));