Received: by 10.223.164.202 with SMTP id h10csp2362400wrb; Sat, 18 Nov 2017 20:16:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMYUr3IBuZVTIQtlKpbdgODKStH71TZPy3B0Czw9fQdz3vis2GcUbBKpUI2q3WN1wzJ4uDZl X-Received: by 10.159.229.136 with SMTP id az8mr9936900plb.423.1511065009991; Sat, 18 Nov 2017 20:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511065009; cv=none; d=google.com; s=arc-20160816; b=jOfWBbyJgAt94v/y21vSZOg5lbfOOCRksV+G3zfnh7C2hdAW4wO4846l7ZM9iinlKp gml0KXnkqn5/+hl1aTbl/IPcX9S8MDx2r1IdKddFeW0oBnOr1HVHmYgdxSyEE9fER8YS TSADtHvyYmRXagOehFkZZOplxYe5TIqMR3ck+O44i0niaw3c91xZ0meCxu6UFmMN5YuH B7dWq9QwP8eGJFTqDBO1W0gn1yg5X35kpeL7+iUIoFgPo81rWRy0Y8GOYaA0d16ivJ1/ 4aEVTaNEH0io4pO1G/hVrrI1Qwqvchj2Rl4hSGfr3WXnSafhq3oQbzJ3+aTnKOHa1DEF d1yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=QV0UQqczltKInqdXDp/gAANYFpC6JJNXw1+d7Py0qIk=; b=inkrjrYKe9e6EadbKthpXZgQ8zvROIXHew3EjE6I3CcmJnBFj8BFSu0ET9QwpPkGU2 XuA/ZL3MsVGP9rHu7Hmxk3xFCLFGH8xWVV5ZvlfcyzxYOiBFTX8oqaELIfkiZmGF79Cg GPdcYbk0qGjdCspj6CKHQatEaBGZ5q5k6bAI7bW/e7sbilnEuuFD0y9iia1Qenf+TN2P xQ0JLNCp2AZ6MUyYplHbWNrJwwW9UvUyFZ6LQUSwu1Lg7V1ClSmJHTH5ANgMJJcLLxZq 3pFlkqHSTzLxZgpb15YKSTQkSkbVtz5NWwJoFoXYJ/if7pPgTD+GVtVYIEMeRromNPBn UbKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si5485781pgd.252.2017.11.18.20.16.37; Sat, 18 Nov 2017 20:16:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424407AbdKRSIC (ORCPT + 92 others); Sat, 18 Nov 2017 13:08:02 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:27009 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423099AbdKRSHy (ORCPT ); Sat, 18 Nov 2017 13:07:54 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAII7pO5001325 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 18 Nov 2017 18:07:51 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vAII7pao004708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 18 Nov 2017 18:07:51 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vAII7ocJ022031; Sat, 18 Nov 2017 18:07:50 GMT Received: from [10.39.244.8] (/10.39.244.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 18 Nov 2017 10:07:50 -0800 Subject: Re: Commit fcd8843c40 breaks old compilers To: Trond Myklebust , "Anna.Schumaker@Netapp.com" Cc: "linux-kernel@vger.kernel.org" , "linux-nfs@vger.kernel.org" References: <09a3d9ca-d191-5899-613d-8d0dbe0b68ea@oracle.com> <1511026783.10238.2.camel@primarydata.com> From: Boris Ostrovsky Message-ID: <49fec52f-229a-4657-a80d-d1a40a9d38e4@oracle.com> Date: Sat, 18 Nov 2017 13:07:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1511026783.10238.2.camel@primarydata.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/18/2017 12:39 PM, Trond Myklebust wrote: > On Sat, 2017-11-18 at 12:19 -0500, Boris Ostrovsky wrote: >> Commit fcd8843c406b46433857ae45e5e9d84b01a7d20b breaks on older >> compilers which cannot process initializers for anonymous structures: >> >> +const nfs4_stateid invalid_stateid = { >> + { >> + .seqid = cpu_to_be32(0xffffffffU), >> + .other = { 0 }, >> + }, >> + .type = NFS4_INVALID_STATEID_TYPE, >> +}; >> >> >> /home/build/linux-linus/fs/nfs/nfs4state.c:74: error: unknown field >> ‘seqid’ specified in initializer >> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: missing >> braces >> around initializer >> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: (near >> initialization for ‘invalid_stateid..data’) >> /home/build/linux-linus/fs/nfs/nfs4state.c:74: warning: overflow in >> implicit constant conversion >> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: unknown field >> ‘other’ specified in initializer >> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: extra brace >> group >> at end of initializer >> /home/build/linux-linus/fs/nfs/nfs4state.c:75: error: (near >> initialization for ‘invalid_stateid.’) >> /home/build/linux-linus/fs/nfs/nfs4state.c:75: warning: excess >> elements >> in union initializer >> /home/build/linux-linus/fs/nfs/nfs4state.c:75: warning: (near >> initialization for ‘invalid_stateid.’) >> make[4]: *** [fs/nfs/nfs4state.o] Error 1 >> make[3]: *** [fs/nfs] Error 2 >> >> >> FC-64 gcc --version >> gcc (GCC) 4.4.4 20100503 (Red Hat 4.4.4-2) >> >> >> A similar bug was fixed by e0714ec4f9efe7b86828b0dcc077fd8f5d8e5e91 >> but >> I don't think the same approach can work here. > > > I don't have any setups with gcc 4.4.4. What is it expecting here? Is > it expecting an extra set of braces due to the anonymous "struct"? > No, that won't work (at least I couldn't get it to work) because the solution from e0714ec4f9e assumes that the anonymous struct is the first one in the enveloping struct. It worked only if I (this is a small C program with equivalent structs): struct nfs4_stateid_struct { union { //char data[4]; struct { unsigned seqid; char other[6]; } __attribute__ ((packed)); char data[4]; }; and then const nfs4_stateid invalid_stateid = { { {.seqid = 0xffffffffU, .other = { 0 } }, }, .type = NFS4_INVALID_STATEID_TYPE, }; If I keep data[4] where it is now I get compiler error an.c:35:20: error: field name not in record or union initializer {.seqid = 0xffffffffU, ^ an.c:35:20: note: (near initialization for 'invalid_stateid..data') an.c:35:29: warning: overflow in implicit constant conversion [-Woverflow] {.seqid = 0xffffffffU, ^~~~~~~~~~~ an.c:36:19: error: field name not in record or union initializer .other = { 0 } }, ^ an.c:36:19: note: (near initialization for 'invalid_stateid..data') an.c:36:19: warning: braces around scalar initializer an.c:36:19: note: (near initialization for 'invalid_stateid..data[1]') I don't know if you want to change public header file just to get around this problem. -boris From 1584466461486741253@xxx Sun Nov 19 04:16:09 +0000 2017 X-GM-THRID: 1584466461486741253 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread