Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC warnings with stricter compiler checks ("main" branch) #4253

Open
eero-t opened this issue Jan 24, 2024 · 1 comment
Open

GCC warnings with stricter compiler checks ("main" branch) #4253

eero-t opened this issue Jan 24, 2024 · 1 comment

Comments

@eero-t
Copy link
Contributor

eero-t commented Jan 24, 2024

  • Version of collectd: main branch HEAD
  • Operating system / distribution: F38

Expected behavior

Code compiles without warnings even with stricter options.

Actual behavior

Large number of warnings:
build.txt

Steps to reproduce

$ FLAGS="-O3 -Wall -Wextra -Wno-missing-field-initializers -Wcast-align=strict \
  -Wformat-security -Wnull-dereference -Wstrict-overflow=2 -Warray-bounds=2 \
  -D_FORTIFY_SOURCE=2 -Wno-aggressive-loop-optimizations"
$ CFLAGS=$FLAGS CXXFLAGS=$FLAGS  ./autogen.sh
$ make
@eero-t
Copy link
Contributor Author

eero-t commented Jan 24, 2024

Compared to #3969, I've added few extra warning options (+ _FORTIFY_SOURCE), GCC version is newer (13.2 in F38, instead of 11.2 in F35), and I've installed all the dependencies found in Fedora, resulting in much shorter list of plugins not being compiled:

    epics . . . . . . . . no (pkg-config could not find epics-base)
    intel mic . . . . . . no (MicAccessApi not found)
    libaquaero5 . . . . . no (libaquaero5.h not found)
    libganglia  . . . . . no (rpc/types.h not found)
    libiptc . . . . . . . no (pkg-config doesn't know libiptc)
    libjevents  . . . . . no (jevents.h not found)
    libkstat  . . . . . . no (Solaris only)
    libnetapp . . . . . . no (netapp_api.h not found)
    libperfstat . . . . . no (AIX only)
    libpmwapi . . . . . . no (pmw_api.h not found)
    libpqos . . . . . . . no (pqos.h not found)
    librouteros . . . . . no (routeros_api.h not found)
    libsigrok   . . . . . no (pkg-config could not find libsigrok)
    libslurm .  . . . . . no (pkg-config doesn't know libslurm)
    libtokyotyrant  . . . no (tcrdb.h not found)
    oracle  . . . . . . . no (ORACLE_HOME is not set)
    aquaero . . . . . . . no (libaquaero5.h not found)
    dcpmm  . . . . . .  . no (pmw_api.h not found)
    epics . . . . . . . . no (pkg-config could not find epics-base)
    gmond . . . . . . . . no (rpc/types.h not found)
    intel_pmu . . . . . . no (jevents.h not found)
    intel_rdt . . . . . . no (pqos.h not found)
    iptables  . . . . . . no (pkg-config doesn't know libiptc)
    lpar  . . . . . . . . no (AIX only)
    mic . . . . . . . . . no (MicAccessApi not found)
    netapp  . . . . . . . no (netapp_api.h not found)
    oracle  . . . . . . . no (ORACLE_HOME is not set)
    perl  . . . . . . . . no (needs libperl)
    redfish . . . . . . . no (redfish.h not found)
    routeros  . . . . . . no (routeros_api.h not found)
    sigrok  . . . . . . . no (pkg-config could not find libsigrok)
    slurm . . . . . . . . no (pkg-config doesn't know libslurm)
    tokyotyrant . . . . . no (tcrdb.h not found)

PS. If one adds also -Wpendantic option, there are these additional warnings:

$ diff -ub build.txt build-pedantic.txt| grep '^+.*warning:' | sed -e 's/:[0-9]\+:[0-9]\+:/:/' -e 's/\[-Wpedantic\]//' | cut -b6- | sort | uniq -c
     11 daemon/plugin.c: warning: ISO C forbids assignment between function pointer and ‘void *’ 
      9 daemon/plugin.c: warning: ISO C forbids conversion of function pointer to object pointer type 
      2 daemon/plugin.c: warning: ISO C forbids initialization between function pointer and ‘void *’ 
      4 daemon/utils_time.h: warning: ISO C++ forbids compound-literals 
      2 dpdkevents.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      2 dpdkstat.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      1 dpdk_telemetry.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      2 grpc.cc: warning: C++ designated initializers only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
      1 java.c: warning: ISO C forbids assignment between function pointer and 'void *' 
      1 java.c: warning: ISO C forbids conversion of function pointer to object pointer type 
     15 java.c: warning: ISO C forbids initialization between function pointer and 'void *' 
      2 mcelog.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
     12 mdevents.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      3 mdevents.c: warning: ISO C forbids empty initializer braces before C2X 
      1 processes.c: warning: ISO C forbids empty initializer braces before C2X 
      1 python.c: warning: format '%p' expects argument of type 'void *', but argument 4 has type 'PyObject *' {aka 'struct _object *'} [-Wformat=]
      8 python.c: warning: ISO C forbids conversion of function pointer to object pointer type 
      1 python.c: warning: ISO C forbids conversion of object pointer to function pointer type 
      1 smart.c: warning: ISO C forbids empty initializer braces before C2X 
     12 snmp.c: warning: embedding a directive within macro arguments is not portable
     34 utils/dpdk/dpdk.c: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      6 utils/dpdk/dpdk.h: warning: ISO C does not support '__FUNCTION__' predefined identifier 
      1 utils/format_kairosdb/format_kairosdb.c: warning: unknown escape sequence: '\{'
      6 utils/ovs/ovs.c: warning: ISO C does not support '__FUNCTION__' predefined identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant