blob: 73adecc594ae48aad4238c31a804f2118548521e [file] [log] [blame]
Stewart Smith8b90e5b2016-11-03 13:43:24 +11001From b315c53f2803b84e35fe646aa82702b82e8ecd98 Mon Sep 17 00:00:00 2001
2From: Stewart Smith <stewart@linux.vnet.ibm.com>
3Date: Thu, 25 Aug 2016 20:07:58 +1000
4Subject: [PATCH 08/10] Fix compiler can assume address will never be NULL
5 error with GCC6
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10So, it turns out that relying on the address of something passed by
11reference being able to be NULL isn't exactly a good idea, or remotely
12obvious code. So, instead, do the sane thing and pass a pointer and
13check it.
14
15../../../../src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H:
16In constructor ‘PRDF::AttnTypeRegister::AttnTypeRegister(PRDF::SCAN_COMM_REGISTE
17R_CLASS&, PRDF::SCAN_COMM_REGISTER_CLASS&, PRDF::SCAN_COMM_REGISTER_CLASS&, PRDF
18::SCAN_COMM_REGISTER_CLASS&)’:
19../../../../src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H:4
2042:21: error: the compiler can assume that the address of ‘i_check’ will never b
21e NULL [-Werror=address]
22 iv_check( NULL == &i_check ? &cv_null : &i_check),
23 ~~^~~~~~~~~~~
24../../../../src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H:4
2543:21: error: the compiler can assume that the address of ‘i_recov’ will never b
26e NULL [-Werror=address]
27 iv_recov( NULL == &i_recov ? &cv_null : &i_recov),
28 ~~^~~~~~~~~~~
29../../../../src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H:4
3044:22: error: the compiler can assume that the address of ‘i_special’ will never
31 be NULL [-Werror=address]
32 iv_special(NULL == &i_special ? &cv_null : &i_special),
33 ~~^~~~~~~~~~~~~
34../../../../src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H:4
3545:22: error: the compiler can assume that the address of ‘i_proccs’ will never
36be NULL [-Werror=address]
37 iv_proccs( NULL == &i_proccs ? &cv_null : &i_proccs),
38 ~~^~~~~~~~~~~~
39
40Change-Id: Iecd8636da67aac24f64f73fd82b1f7ccbfced900
41Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
42---
43 .../common/framework/register/prdfOperatorRegister.H | 16 ++++++++--------
44 .../prdf/common/framework/register/prdfScanFacility.C | 2 +-
45 2 files changed, 9 insertions(+), 9 deletions(-)
46
47diff --git a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
48index b0513e4..a26a76e 100755
49--- a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
50+++ b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
51@@ -434,15 +434,15 @@ class AttnTypeRegister : public SCAN_COMM_REGISTER_CLASS
52 iv_bs = &iv_iBS;
53 }
54
55- AttnTypeRegister( SCAN_COMM_REGISTER_CLASS & i_check,
56- SCAN_COMM_REGISTER_CLASS & i_recov,
57- SCAN_COMM_REGISTER_CLASS & i_special,
58- SCAN_COMM_REGISTER_CLASS & i_proccs ) :
59+ AttnTypeRegister( SCAN_COMM_REGISTER_CLASS *i_check,
60+ SCAN_COMM_REGISTER_CLASS *i_recov,
61+ SCAN_COMM_REGISTER_CLASS *i_special,
62+ SCAN_COMM_REGISTER_CLASS *i_proccs ) :
63 SCAN_COMM_REGISTER_CLASS( ),
64- iv_check( NULL == &i_check ? &cv_null : &i_check),
65- iv_recov( NULL == &i_recov ? &cv_null : &i_recov),
66- iv_special(NULL == &i_special ? &cv_null : &i_special),
67- iv_proccs( NULL == &i_proccs ? &cv_null : &i_proccs),
68+ iv_check( NULL == i_check ? &cv_null : i_check),
69+ iv_recov( NULL == i_recov ? &cv_null : i_recov),
70+ iv_special(NULL == i_special ? &cv_null : i_special),
71+ iv_proccs( NULL == i_proccs ? &cv_null : i_proccs),
72 iv_iBS(0) // will fully initialize this inside ctor.
73 {
74 uint32_t l_length = 1024;
75diff --git a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C
76index 0d379cf..cad5ce8 100755
77--- a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C
78+++ b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C
79@@ -166,7 +166,7 @@ SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAttnTypeRegister(
80 SCAN_COMM_REGISTER_CLASS * i_special,
81 SCAN_COMM_REGISTER_CLASS * i_proccs )
82 {
83- AttnTypeRegister r(*i_check, *i_recov, *i_special, *i_proccs);
84+ AttnTypeRegister r(i_check, i_recov, i_special, i_proccs);
85 return iv_attnRegFw.get(r);
86 }
87
88--
892.7.4
90