apps, func_tests: adapt cflags for older architectures
commit57911d27b7a5b694aa7ad1ed6b3d8547fcf2d93e
authorDaniel Borkmann <dborkman@redhat.com>
Tue, 22 Jan 2013 14:23:22 +0000 (22 15:23 +0100)
committerDaniel Borkmann <dborkman@redhat.com>
Tue, 22 Jan 2013 14:29:08 +0000 (22 15:29 +0100)
tree2f02550fc05e430c7798f7ceba4fbaf324325003
parent296e5aba4798d8dbf2d949bdebbf70496c312c1e
apps, func_tests: adapt cflags for older architectures

Quoting RFC3493:

   One simple addition to the sockets API that can help application
   writers is the "struct sockaddr_storage".  This data structure can
   simplify writing code that is portable across multiple address
   families and platforms.  This data structure is designed with the
   following goals.

   - Large enough to accommodate all supported protocol-specific address
     structures.

   - Aligned at an appropriate boundary so that pointers to it can be
     cast as pointers to protocol specific address structures and used
     to access the fields of those structures without alignment
     problems.

   The sockaddr_storage structure contains field ss_family which is of
   type sa_family_t.  When a sockaddr_storage structure is cast to a
   sockaddr structure, the ss_family field of the sockaddr_storage
   structure maps onto the sa_family field of the sockaddr structure.
   When a sockaddr_storage structure is cast as a protocol specific
   address structure, the ss_family field maps onto a field of that
   structure that is of type sa_family_t and that identifies the
   protocol's address family.

So then don't let the compiler bitch about this and use the same flag
to work around this as the Linux kernel does.

Here's what GCC version is affected:

  gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) --> complains
  gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) --> doesn't complain

Also, we add -O2 for additional data flow analysis that otherwise we
wouldn't have.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
src/apps/Makefile.am
src/func_tests/Makefile.am