From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23163 invoked by alias); 4 Feb 2014 17:30:50 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 23108 invoked by uid 48); 4 Feb 2014 17:30:43 -0000 From: "alvarezp at alvarezp dot ods.org" To: glibc-bugs@sourceware.org Subject: [Bug network/16421] IN6_IS_ADDR_UNSPECIFIED can use undefined s6_addr32 Date: Tue, 04 Feb 2014 17:30:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: alvarezp at alvarezp dot ods.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00043.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16421 --- Comment #12 from Octavio Alvarez --- Thank you. Today I have learned about statement expressions and how they are GCC extensions. If we add an #ifdef __GNUC__ we would also have to add an #else that avoids the usage of non-ISO C extensions anyway so Clang do not throw any warnings or compilers that don't define __GNUC__ still have IN6_* macros available. Again, two implementations. Now I understand why was the original code in that form. If the goal is to have a universal implementation it's no use to have it wrapped in #ifdef __GNUC__. It just stops being universal. Given the above, there is no use on exposing __in6_u.__u6_addr32 for the purpose of fixing this bug, then. Either we go back to patch #1, which keeps both implementations and just adds the test for definition of __USE_GNU and __USE_MISC macros and does not break strict compilers, or we remove the #ifdef __GNUC__ implementation altogether and leave only the #else implementation unconditionally. Sample of the #else implementation: # define IN6_IS_ADDR_UNSPECIFIED(a) \ (((const uint32_t *) (a))[0] == 0 \ && ((const uint32_t *) (a))[1] == 0 \ && ((const uint32_t *) (a))[2] == 0 \ && ((const uint32_t *) (a))[3] == 0) I will gladly attach a patch with just the #else implementation for your review, but I still think the best bet to use the original patch. Git commit aff2453d [1] (Dec 2011) shows that originally, only the #else implementation existed but Ulrich Drepper added a GCC-specific implementation, apparently to avoid warnings. Later, in commit a784e502 [2] (Jan 2012), he changed the usage of __const to plain const, removing pre-ISO C implementations. -- You are receiving this mail because: You are on the CC list for the bug.