ue_sync: fix 32bit compilation

fix printf format string on 32bit arches like ARMv7

FAILED: lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o
/usr/bin/gcc -DASSERTS_ENABLED -DENABLE_TIMEPROF -DENABLE_TTCN3 -DHAVE_BACKWARD -DHAVE_MBEDTLS -DHAVE_PCSC -I/usr/include/PCSC -I/usr/include/SoapySDR -Ilib/include -I../lib/include -Wno-unused-but-set-variable -Wall -Wno-comment -Wno-write-strings -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -fno-strict-aliasing -D_GNU_SOURCE -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE -DIS_ARM -DHAVE_NEON -mfloat-abi=hard -mfpu=neon -fvisibility=hidden -fdiagnostics-color=always -Werror --param large-function-growth=1600 -O3 -DNDEBUG -fPIC -MD -MT lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o -MF lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o.d -o lib/src/phy/ue/CMakeFiles/srsran_ue.dir/ue_sync.c.o   -c ../lib/src/phy/ue/ue_sync.c
In file included from ../lib/include/srsran/srsran.h:31,
                 from ../lib/src/phy/ue/ue_sync.c:13:
../lib/src/phy/ue/ue_sync.c: In function ‘srsran_ue_sync_set_tti_from_timestamp’:
../lib/include/srsran/phy/utils/debug.h:59:23: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
       fprintf(stdout, "[DEBUG]: " _fmt "\n", ##__VA_ARGS__);                                                           \
                       ^~~~~~~~~~~
../lib/src/phy/ue/ue_sync.c:1044:3: note: in expansion of macro ‘DEBUG’
   DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs);
   ^~~~~
../lib/src/phy/ue/ue_sync.c:1044:41: note: format string is defined here
   DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs);
                                       ~~^
                                       %llu
cc1: all warnings being treated as errors
This commit is contained in:
Andre Puschmann 2021-10-27 09:28:09 +02:00
parent 00b82bc772
commit 7f6801cb1e
1 changed files with 1 additions and 1 deletions

View File

@ -1041,7 +1041,7 @@ int srsran_ue_sync_set_tti_from_timestamp(srsran_ue_sync_t* q, srsran_timestamp_
// convert to ms and add fractional part
uint64_t time_3gpp_msecs = (time_3gpp_secs + rx_timestamp->frac_secs) * MSECS_PER_SEC;
DEBUG("rx time with 3gpp base in ms %lu\n", time_3gpp_msecs);
DEBUG("rx time with 3gpp base in ms %" PRIu64 "\n", time_3gpp_msecs);
// calculate SFN and SF index according to TS 36.331 Sec. 5.10.14
q->frame_number = (uint32_t)(((uint64_t)floor(0.1 * (time_3gpp_msecs - q->sfn_offset))) % 1024);