[PATCH] osmo-pcu[master]: BTS: fix overloading ambiguity

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Mar 6 16:40:33 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1981

to look at the new patch set (#2).

BTS: fix overloading ambiguity

cast the result of rfn - m_cur_rfn to long int explicitly to avoid
the overloading ambiguity between various abs() implementations for
int, long int, long long int.

Fixes opensuse builds for nightly packages, which had error:

[  110s] bts.cpp: In member function 'uint32_t BTS::rfn_to_fn(uint32_t)':
[  110s] bts.cpp:553:25: error: call of overloaded 'abs(uint32_t)' is ambiguous
[  110s]   if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) {
[  110s]                          ^
[  110s] In file included from /usr/include/c++/6/cstdlib:75:0,
[  110s]                  from /usr/include/c++/6/stdlib.h:36,
[  110s]                  from /usr/include/osmocom/core/linuxrbtree.h:97,
[  110s]                  from /usr/include/osmocom/core/timer.h:35,
[  110s]                  from ./bts.h:29,
[  110s]                  from bts.cpp:21:
[  110s] /usr/include/stdlib.h:735:12: note: candidate: int abs(int)
[  110s]  extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
[  110s]             ^~~
[  110s] In file included from /usr/include/c++/6/stdlib.h:36:0,
[  110s]                  from /usr/include/osmocom/core/linuxrbtree.h:97,
[  110s]                  from /usr/include/osmocom/core/timer.h:35,
[  110s]                  from ./bts.h:29,
[  110s]                  from bts.cpp:21:
[  110s] /usr/include/c++/6/cstdlib:185:3: note: candidate: __int128 std::abs(__int128)
[  110s]    abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
[  110s]    ^~~
[  110s] /usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
[  110s]    abs(long long __x) { return __builtin_llabs (__x); }
[  110s]    ^~~
[  110s] /usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
[  110s]    abs(long __i) { return __builtin_labs(__i); }
[  110s]    ^~~


Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d
---
M src/bts.cpp
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/81/1981/2

diff --git a/src/bts.cpp b/src/bts.cpp
index 548d000..75beaec 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -550,7 +550,7 @@
 	 * number exceeds a certain limit, we need to assume that the incoming
 	 * rach request belongs to a the previous rfn period. To correct this,
 	 * we roll back the rounded frame number by one RFN_MODULUS */
-	if (abs(rfn - m_cur_rfn) > RFN_THRESHOLD) {
+	if (abs((long int)(rfn - m_cur_rfn)) > RFN_THRESHOLD) {
 		LOGP(DRLCMAC, LOGL_DEBUG,
 		     "Race condition between rfn (%u) and m_cur_fn (%u) detected: rfn belongs to the previos modulus %u cycle, wrappng...\n",
 		     rfn, m_cur_fn, RFN_MODULUS);

-- 
To view, visit https://gerrit.osmocom.org/1981
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I146dd82d9a18b1ad28749f960068d3b4e4cbfd9d
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list