aboutsummaryrefslogtreecommitdiff
path: root/soft-fp/extended.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-06-30 17:36:18 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-06-30 17:36:18 +0000
commit9c37ec0b8929c57ea83230507d7742ca9a8888bc (patch)
treebbc2344014cd2b5a172faad1e04ad815c5a1c4ce /soft-fp/extended.h
parent2125f674541eba23bfa3fffe8ccf75c2e82d468c (diff)
downloadglibc-9c37ec0b8929c57ea83230507d7742ca9a8888bc.zip
glibc-9c37ec0b8929c57ea83230507d7742ca9a8888bc.tar.gz
glibc-9c37ec0b8929c57ea83230507d7742ca9a8888bc.tar.bz2
Rename soft-fp extended.h, op-common.h variables to avoid risk of shadowing.
In <https://sourceware.org/ml/libc-alpha/2013-06/msg00851.html>, I fixed a bug caused by multiple soft-fp macros using the same variable names, resulting in shadowing when one macro called another that used the same variable name, with an argument involving the variable in the outer macro. The fix was to rename the local variables so their names included the containing macro name, to ensure uniqueness. I noted then that this would make sense more systematically for all variables in any soft-fp macro. Since then, I've used such variable names in new soft-fp macros. This patch now converts existing macros in extended.h and op-common.h to use this convention. (op-[1248].h are intended to be converted separately.) (Name conflicts could arise for label names as well, but because those are function-scope in C any such conflict will give an immediate compile error rather than a subtle bug, so there's no need for preemptive renaming in that case.) Tested for powerpc32 (soft-float) and mips64 that this makes no change to the disassembly of installed shared libraries. * soft-fp/extended.h (FP_UNPACK_RAW_E): Rename local variables to include macro name. (FP_UNPACK_RAW_EP): Likewise. (FP_PACK_RAW_E): Likewise. (FP_PACK_RAW_EP): Likewise. * soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Likewise. (_FP_ISSIGNAN): Likewise. (_FP_ADD_INTERNAL): Likewise. (_FP_FMA): Likewise. (_FP_CMP): Likewise. (_FP_SQRT): Likewise. (_FP_TO_INT): Likewise. (_FP_FROM_INT): Likewise. (FP_EXTEND): Likewise. (_FP_DIV_MEAT_N_loop): Likewise.
Diffstat (limited to 'soft-fp/extended.h')
-rw-r--r--soft-fp/extended.h172
1 files changed, 88 insertions, 84 deletions
diff --git a/soft-fp/extended.h b/soft-fp/extended.h
index 69a5a06..940bdf1 100644
--- a/soft-fp/extended.h
+++ b/soft-fp/extended.h
@@ -91,70 +91,72 @@ union _FP_UNION_E
# define FP_DECL_E(X) _FP_DECL (4, X)
-# define FP_UNPACK_RAW_E(X, val) \
- do \
- { \
- union _FP_UNION_E _flo; \
- _flo.flt = (val); \
- \
- X##_f[2] = 0; \
- X##_f[3] = 0; \
- X##_f[0] = _flo.bits.frac0; \
- X##_f[1] = _flo.bits.frac1; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
- } \
+# define FP_UNPACK_RAW_E(X, val) \
+ do \
+ { \
+ union _FP_UNION_E FP_UNPACK_RAW_E_flo; \
+ FP_UNPACK_RAW_E_flo.flt = (val); \
+ \
+ X##_f[2] = 0; \
+ X##_f[3] = 0; \
+ X##_f[0] = FP_UNPACK_RAW_E_flo.bits.frac0; \
+ X##_f[1] = FP_UNPACK_RAW_E_flo.bits.frac1; \
+ X##_e = FP_UNPACK_RAW_E_flo.bits.exp; \
+ X##_s = FP_UNPACK_RAW_E_flo.bits.sign; \
+ } \
while (0)
-# define FP_UNPACK_RAW_EP(X, val) \
- do \
- { \
- union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
- \
- X##_f[2] = 0; \
- X##_f[3] = 0; \
- X##_f[0] = _flo->bits.frac0; \
- X##_f[1] = _flo->bits.frac1; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } \
+# define FP_UNPACK_RAW_EP(X, val) \
+ do \
+ { \
+ union _FP_UNION_E *FP_UNPACK_RAW_EP_flo \
+ = (union _FP_UNION_E *) (val); \
+ \
+ X##_f[2] = 0; \
+ X##_f[3] = 0; \
+ X##_f[0] = FP_UNPACK_RAW_EP_flo->bits.frac0; \
+ X##_f[1] = FP_UNPACK_RAW_EP_flo->bits.frac1; \
+ X##_e = FP_UNPACK_RAW_EP_flo->bits.exp; \
+ X##_s = FP_UNPACK_RAW_EP_flo->bits.sign; \
+ } \
while (0)
# define FP_PACK_RAW_E(val, X) \
do \
{ \
- union _FP_UNION_E _flo; \
+ union _FP_UNION_E FP_PACK_RAW_E_flo; \
\
if (X##_e) \
X##_f[1] |= _FP_IMPLBIT_E; \
else \
X##_f[1] &= ~(_FP_IMPLBIT_E); \
- _flo.bits.frac0 = X##_f[0]; \
- _flo.bits.frac1 = X##_f[1]; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
+ FP_PACK_RAW_E_flo.bits.frac0 = X##_f[0]; \
+ FP_PACK_RAW_E_flo.bits.frac1 = X##_f[1]; \
+ FP_PACK_RAW_E_flo.bits.exp = X##_e; \
+ FP_PACK_RAW_E_flo.bits.sign = X##_s; \
\
- (val) = _flo.flt; \
+ (val) = FP_PACK_RAW_E_flo.flt; \
} \
while (0)
-# define FP_PACK_RAW_EP(val, X) \
- do \
- { \
- if (!FP_INHIBIT_RESULTS) \
- { \
- union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
- \
- if (X##_e) \
- X##_f[1] |= _FP_IMPLBIT_E; \
- else \
- X##_f[1] &= ~(_FP_IMPLBIT_E); \
- _flo->bits.frac0 = X##_f[0]; \
- _flo->bits.frac1 = X##_f[1]; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } \
- } \
+# define FP_PACK_RAW_EP(val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *FP_PACK_RAW_EP_flo \
+ = (union _FP_UNION_E *) (val); \
+ \
+ if (X##_e) \
+ X##_f[1] |= _FP_IMPLBIT_E; \
+ else \
+ X##_f[1] &= ~(_FP_IMPLBIT_E); \
+ FP_PACK_RAW_EP_flo->bits.frac0 = X##_f[0]; \
+ FP_PACK_RAW_EP_flo->bits.frac1 = X##_f[1]; \
+ FP_PACK_RAW_EP_flo->bits.exp = X##_e; \
+ FP_PACK_RAW_EP_flo->bits.sign = X##_s; \
+ } \
+ } \
while (0)
# define FP_UNPACK_E(X, val) \
@@ -323,61 +325,63 @@ union _FP_UNION_E
# define FP_UNPACK_RAW_E(X, val) \
do \
{ \
- union _FP_UNION_E _flo; \
- _flo.flt = (val); \
+ union _FP_UNION_E FP_UNPACK_RAW_E_flo; \
+ FP_UNPACK_RAW_E_flo.flt = (val); \
\
- X##_f0 = _flo.bits.frac; \
+ X##_f0 = FP_UNPACK_RAW_E_flo.bits.frac; \
X##_f1 = 0; \
- X##_e = _flo.bits.exp; \
- X##_s = _flo.bits.sign; \
+ X##_e = FP_UNPACK_RAW_E_flo.bits.exp; \
+ X##_s = FP_UNPACK_RAW_E_flo.bits.sign; \
} \
while (0)
-# define FP_UNPACK_RAW_EP(X, val) \
- do \
- { \
- union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
- \
- X##_f0 = _flo->bits.frac; \
- X##_f1 = 0; \
- X##_e = _flo->bits.exp; \
- X##_s = _flo->bits.sign; \
- } \
+# define FP_UNPACK_RAW_EP(X, val) \
+ do \
+ { \
+ union _FP_UNION_E *FP_UNPACK_RAW_EP_flo \
+ = (union _FP_UNION_E *) (val); \
+ \
+ X##_f0 = FP_UNPACK_RAW_EP_flo->bits.frac; \
+ X##_f1 = 0; \
+ X##_e = FP_UNPACK_RAW_EP_flo->bits.exp; \
+ X##_s = FP_UNPACK_RAW_EP_flo->bits.sign; \
+ } \
while (0)
# define FP_PACK_RAW_E(val, X) \
do \
{ \
- union _FP_UNION_E _flo; \
+ union _FP_UNION_E FP_PACK_RAW_E_flo; \
\
if (X##_e) \
X##_f0 |= _FP_IMPLBIT_E; \
else \
X##_f0 &= ~(_FP_IMPLBIT_E); \
- _flo.bits.frac = X##_f0; \
- _flo.bits.exp = X##_e; \
- _flo.bits.sign = X##_s; \
+ FP_PACK_RAW_E_flo.bits.frac = X##_f0; \
+ FP_PACK_RAW_E_flo.bits.exp = X##_e; \
+ FP_PACK_RAW_E_flo.bits.sign = X##_s; \
\
- (val) = _flo.flt; \
+ (val) = FP_PACK_RAW_E_flo.flt; \
} \
while (0)
-# define FP_PACK_RAW_EP(fs, val, X) \
- do \
- { \
- if (!FP_INHIBIT_RESULTS) \
- { \
- union _FP_UNION_E *_flo = (union _FP_UNION_E *) (val); \
- \
- if (X##_e) \
- X##_f0 |= _FP_IMPLBIT_E; \
- else \
- X##_f0 &= ~(_FP_IMPLBIT_E); \
- _flo->bits.frac = X##_f0; \
- _flo->bits.exp = X##_e; \
- _flo->bits.sign = X##_s; \
- } \
- } \
+# define FP_PACK_RAW_EP(fs, val, X) \
+ do \
+ { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *FP_PACK_RAW_EP_flo \
+ = (union _FP_UNION_E *) (val); \
+ \
+ if (X##_e) \
+ X##_f0 |= _FP_IMPLBIT_E; \
+ else \
+ X##_f0 &= ~(_FP_IMPLBIT_E); \
+ FP_PACK_RAW_EP_flo->bits.frac = X##_f0; \
+ FP_PACK_RAW_EP_flo->bits.exp = X##_e; \
+ FP_PACK_RAW_EP_flo->bits.sign = X##_s; \
+ } \
+ } \
while (0)