From 60b83d84ea8fb614139d81ef8c7f39df0cb8d786 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 23 Feb 2017 11:01:45 +0100
Subject: [PATCH] hotfix: pass "%s" to LOG_W to avoid compilation warnings

The warning was:

------------------------
In file included from /roux/openairinterface5g/openair2/UTIL/LOG/log.h:306:0,
                 from /roux/openairinterface5g/openair1/PHY/defs.h:54,
                 from /roux/openairinterface5g/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c:33:
/roux/openairinterface5g/openair2/UTIL/LOG/log.h: In function 'printMeas':
/roux/openairinterface5g/common/utils/T/T.h:94:26: warning: format not a string literal and no format arguments [-Wformat-security]
 #define T_ID(x) ((struct T_header *)(uintptr_t)(x))
                          ^
/roux/openairinterface5g/common/utils/T/T.h:29:22: note: in definition of macro 'T_PUT_int'
     int T_PUT_var = (val); \
                      ^
/roux/openairinterface5g/common/utils/T/T.h:269:7: note: in expansion of macro 'T_HEADER'
       T_HEADER(t); \
       ^
/roux/openairinterface5g/common/utils/T/T.h:101:76: note: in expansion of macro 'T3'
         n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
                                                                            ^
/roux/openairinterface5g/common/utils/T/T.h:102:16: note: in expansion of macro 'TN'
 #define T(...) TN(__VA_ARGS__)
                ^
/roux/openairinterface5g/openair2/UTIL/LOG/log.h:308:28: note: in expansion of macro 'T'
 #    define LOG_W(c, x...) T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x))
                            ^
/roux/openairinterface5g/common/utils/T/T_IDs.h:71:30: note: in expansion of macro 'T_ID'
 #define T_LEGACY_PHY_WARNING T_ID(68)
                              ^
/roux/openairinterface5g/openair2/UTIL/LOG/log.h:308:30: note: in expansion of macro 'T_LEGACY_PHY_WARNING'
 #    define LOG_W(c, x...) T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x))
                              ^
/roux/openairinterface5g/openair2/UTIL/LOG/log.h:411:9: note: in expansion of macro 'LOG_W'
         LOG_W(PHY,txt2);
------------------------

over and over.

By replacing LOG_W(PHY,txt2) by LOG_W(PHY,"%s",txt2) all the warnings
are removed.
---
 openair2/UTIL/LOG/log.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h
index b31efbcf749..3a67e85d3d9 100644
--- a/openair2/UTIL/LOG/log.h
+++ b/openair2/UTIL/LOG/log.h
@@ -408,7 +408,7 @@ static inline void printMeas(char * txt, Meas *M, int period) {
                 M->iterations,
                 M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5], 
                 M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
-        LOG_W(PHY,txt2);
+        LOG_W(PHY,"%s",txt2);
     }
 }
 
-- 
GitLab