From patchwork Sat Mar 7 01:40:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 447523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AAB921400EA for ; Sat, 7 Mar 2015 12:40:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=sourceware.org header.i=@sourceware.org header.b=XM3FN/G4; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=Ct6jq8ixDtrivlf5wHy3Vt9t89A3m Ng7I3WwwpXX5gQjZWhQrTwmEfZOp8vox0/oxq9QCxqbl03biCz6KWM0eWJ6Xg8LW YXOGY4yuCZO+B+YEI4MueryYR2xxq4lLij2hE6ClRYmwxVXzNqe0OLwK6fwfKDga Rk/fcWkWfAkVeY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=5taxeb92I6dLyGr+Vx+YSv1Oha4=; b=XM3 FN/G4zzlOnBikxZ0sMp4kAC1pmfCMggqbPLOkoDvOfJREJBchrEOWXoQCBluCpKB hgMo+z0Lc9+A9krX42rkTSVXRaMqmY1amVrcd69UHufzRhGMPY7aGiTAOcByVYrb FWaSbO8j3jz52d4WnPQCJI8w0MxGYtbDPdXxb7G4= Received: (qmail 47402 invoked by alias); 7 Mar 2015 01:40:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 47393 invoked by uid 89); 7 Mar 2015 01:40:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Sat, 7 Mar 2015 01:40:31 +0000 From: Joseph Myers To: Subject: soft-fp: Support conditional zero-initialization in declarations [committed] Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 In the Linux kernel, some architectures have a single function that uses different kinds of unpacking and packing depending on the instruction being emulated, meaning it is not readily visible to the compiler that variables from _FP_DECL and _FP_FRAC_DECL_* macros are only used in cases where they were initialized. The existing copy of soft-fp in the Linux kernel uses zero-initialization to avoid warnings in this case, so while frowned upon as a warning suppression mechanism in code built for glibc it seems appropriate to have such zero-initialization conditional on __KERNEL__. This patch duly adds it, via a macro _FP_ZERO_INIT that expands to empty for non-kernel compilations. Tested for powerpc-nofpu that installed stripped shared libraries are unchanged by this patch. Committed. 2015-03-07 Joseph Myers * soft-fp/soft-fp.h (_FP_ZERO_INIT): New macro. Define depending on [__KERNEL__]. * soft-fp/op-1.h (_FP_FRAC_DECL_1): Use _FP_ZERO_INIT. * soft-fp/op-2.h (_FP_FRAC_DECL_2): Likewise. * soft-fp/op-common.h (_FP_DECL): Likewise. diff --git a/soft-fp/op-1.h b/soft-fp/op-1.h index 34c84d0..bc9e33b 100644 --- a/soft-fp/op-1.h +++ b/soft-fp/op-1.h @@ -30,7 +30,7 @@ License along with the GNU C Library; if not, see . */ -#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f +#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f _FP_ZERO_INIT #define _FP_FRAC_COPY_1(D, S) (D##_f = S##_f) #define _FP_FRAC_SET_1(X, I) (X##_f = I) #define _FP_FRAC_HIGH_1(X) (X##_f) diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h index 94a1c71..26bdfc0 100644 --- a/soft-fp/op-2.h +++ b/soft-fp/op-2.h @@ -30,7 +30,8 @@ License along with the GNU C Library; if not, see . */ -#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1 +#define _FP_FRAC_DECL_2(X) \ + _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT #define _FP_FRAC_COPY_2(D, S) (D##_f0 = S##_f0, D##_f1 = S##_f1) #define _FP_FRAC_SET_2(X, I) __FP_FRAC_SET_2 (X, I) #define _FP_FRAC_HIGH_2(X) (X##_f1) diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h index 14fd6cd..ee41476 100644 --- a/soft-fp/op-common.h +++ b/soft-fp/op-common.h @@ -29,10 +29,10 @@ License along with the GNU C Library; if not, see . */ -#define _FP_DECL(wc, X) \ - _FP_I_TYPE X##_c __attribute__ ((unused)); \ - _FP_I_TYPE X##_s __attribute__ ((unused)); \ - _FP_I_TYPE X##_e __attribute__ ((unused)); \ +#define _FP_DECL(wc, X) \ + _FP_I_TYPE X##_c __attribute__ ((unused)) _FP_ZERO_INIT; \ + _FP_I_TYPE X##_s __attribute__ ((unused)) _FP_ZERO_INIT; \ + _FP_I_TYPE X##_e __attribute__ ((unused)) _FP_ZERO_INIT; \ _FP_FRAC_DECL_##wc (X) /* Test whether the qNaN bit denotes a signaling NaN. */ diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index db94e0b..cfd81ec 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -51,6 +51,17 @@ # endif #endif +/* In the Linux kernel, some architectures have a single function that + uses different kinds of unpacking and packing depending on the + instruction being emulated, meaning it is not readily visible to + the compiler that variables from _FP_DECL and _FP_FRAC_DECL_* + macros are only used in cases where they were initialized. */ +#ifdef __KERNEL__ +# define _FP_ZERO_INIT = 0 +#else +# define _FP_ZERO_INIT +#endif + #define _FP_WORKBITS 3 #define _FP_WORK_LSB ((_FP_W_TYPE) 1 << 3) #define _FP_WORK_ROUND ((_FP_W_TYPE) 1 << 2)