Bug 9476 - IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT cause compiler warnings.
Summary: IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT cause compiler warnings.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-02-16 01:11 UTC by Wan-Teh Chang
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-05-22 14:52:53 UTC
Embargoed:


Attachments (Terms of Use)

Description Wan-Teh Chang 2000-02-16 01:11:50 UTC
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 14:52:59 UTC
assign to jakub

Comment 2 Jakub Jelinek 2000-08-24 07:34:45 UTC
Fixed in glibc 2.1.92


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