Bug 9476 - IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT cause compiler warnings.
IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT cause compiler warnings.
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-02-15 20:11 EST by Wan-Teh Chang
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-05-22 10:52:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wan-Teh Chang 2000-02-15 20:11:50 EST
In <netinet/in.h>, we have the following definitions
(simplified for presentation):

/* IPv6 address */
struct in6_addr
  {
    union
      {
        uint8_t         u6_addr8[16];
        uint16_t        u6_addr16[8];
        uint32_t        u6_addr32[4];
        uint64_t        u6_addr64[2];
      } in6_u;
  };

#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }

IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT are initializers
for static variables of the type struct in6_addr.  Because of
the nested struct/union/array definition, there need to be
three pairs of braces around the comma-separated constant
list.  The current definition has only one pair of braces and
hence causes compiler warnings.  A test program and compiler
output follow.

coffee:/u/wtc/tmp 101% cat in6addr.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

struct in6_addr any = IN6ADDR_ANY_INIT;
struct in6_addr loopback = IN6ADDR_LOOPBACK_INIT;

int main()
{
    return 0;
}
coffee:/u/wtc/tmp 102% gcc -Wall in6addr.c
in6addr.c:5: warning: missing braces around initializer for `any.in6_u'
in6addr.c:6: warning: missing braces around initializer for
`loopback.in6_u'
Comment 1 Cristian Gafton 2000-05-22 10:52:59 EDT
assign to jakub
Comment 2 Jakub Jelinek 2000-08-24 03:34:45 EDT
Fixed in glibc 2.1.92

Note You need to log in before you can comment on or make changes to this bug.