8devices / qcacld-2.0

Drivers for BLUE bean and RED bean modules
8 stars 13 forks source link

Compiler warnings with gcc 7.2.1 #16

Closed lategoodbye closed 3 years ago

lategoodbye commented 4 years ago

Hi, tried to compile qcacld-2.0 (default branch) with Linux 4.11 based on this documentation.

Unfortunately step 7 fails because of compiler warnings which are treated as errors:

/home/test/qcacld-2.0/CORE/CLD_TXRX/TXRX/ol_tx_send.c: In function ‘ol_tx_dump_group_credit_stats’:
/home/test/qcacld-2.0/CORE/VOSS/inc/i_vos_trace.h:94:19: error: ‘old_credit’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define VOS_TRACE vos_trace_msg
                   ^~~~~~~~~~~~~
/home/test/qcacld-2.0/CORE/CLD_TXRX/TXRX/ol_tx_send.c:862:25: note: ‘old_credit’ was declared here
     uint16 curr_credit, old_credit, mem_vdevs;
                         ^~~~~~~~~~
cc1: all warnings being treated as errors

/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c: In function ‘DebugDumpBytes’:
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:60:59: error: ‘%4.4X’ directive output truncated writing 4 bytes into a region of size 2 [-Werror=format-truncation=]
             A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
                                                           ^
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:59: note: in definition of macro ‘A_SNPRINTF’
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                                           ^~~~
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:60:59: note: directive argument in the range [0, 65535]
             A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
                                                           ^
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:59: note: in definition of macro ‘A_SNPRINTF’
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                                           ^~~~
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:39: note: ‘snprintf’ output 5 bytes into a destination of size 2
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:60:13: note: in expansion of macro ‘A_SNPRINTF’
             A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
             ^~~~~~~~~~
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:68:55: error: ‘%4.4X’ directive output truncated writing 4 bytes into a region of size 2 [-Werror=format-truncation=]
         A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
                                                       ^
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:59: note: in definition of macro ‘A_SNPRINTF’
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                                           ^~~~
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:68:55: note: directive argument in the range [0, 65535]
         A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
                                                       ^
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:59: note: in definition of macro ‘A_SNPRINTF’
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                                           ^~~~
/home/test/qcacld-2.0/CORE/SERVICES/COMMON/osapi_linux.h:147:39: note: ‘snprintf’ output 5 bytes into a destination of size 2
 #define A_SNPRINTF(buf, len, args...) snprintf (buf, len, args)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/test/qcacld-2.0/CORE/SERVICES/HTC/htc_recv.c:68:9: note: in expansion of macro ‘A_SNPRINTF’
         A_SNPRINTF(byteOffsetStr, sizeof(byteOffset), "%4.4X",byteOffset);
         ^~~~~~~~~~
cc1: all warnings being treated as errors
lategoodbye commented 4 years ago

I used these changes to avoid the warnings:

fix.txt

valinskas commented 3 years ago

There are now multiple branches where driver compiles without problems/warnings:

linux-4.19.y/CNSS.LEA.NRT_3.0 linux-5.4.y/CNSS.LEA.NRT_3.0 linux-5.4.y/CNSS.LEA.NRT_3.1

Warnings are legitimate. Issue closed.