#3896 GCC warnings
Closed: Fixed None Opened 10 years ago by pviktori.

Inspired by Timo Aaltonen's patch and SSSD's build aliases, I've added CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wformat-security" to my build. There are 3 more warnings we might want to fix:

  • ipa_kdb.c:186: missing initializer for field 'name' of 'const struct <anonymous>' [-Wmissing-field-* initializers]
  • otp.c:64: missing initializer for field 'algo' of 'const struct <anonymous>' [-Wmissing-field-initializers]
  • default_encoding_utf8.c:48: missing initializer for field 'ml_flags' of 'PyMethodDef' [-Wmissing-field-initializers]

All these are in sentinel values, for example:

static const struct {
    const char *algo;
    CK_MECHANISM_TYPE mech;
} algo2mech[] = {
   ...
   { "sha512", CKM_SHA512_HMAC },
   { } // <- warning here
};

We'll want to add these, and -Werror, to our Makefile.

With the recent hardened build patch, it's apparently not possible to add custom CFLAGS to make rpms in a way that the hardening flags are used as well.

We'll want to add the warning flags (and possibly -Werror) to the upstream Makefile, or find a way to specify additional CFLAGS.

The build will now fail if any of the mentioned the mentioned warnings, except -Wmissing-field-initializers, are triggered.

master: 5e2f7b6

Metadata Update from @pviktori:
- Issue assigned to jcholast
- Issue set to the milestone: FreeIPA 4.0 - 2013/11

7 years ago

Login to comment on this ticket.

Metadata