Format and typelimit warnings (#169)

* merge with origin 4fc7dbc3 8daa8346

* fixed whitespace diff

* added .gitignore

* added format warning flags to C_FLAGS
added typelimit check to C_FLAGS and CXX_CLAGS

* Revert "added format warning flags to C_FLAGS"

Apply to branch format_and_typelimt branch

This reverts commit bf7467e82e.

* check for format warnings to top level C_FLAGS
added typelimit warnings to top level C_FLAGS and CXX_FLAGS
beset effort attempt to remedy warnings
removed unused param names in hex_log baseclass methods due to multitude of unused-warnings
master
Joseph Giovatto 7 years ago committed by Ismael Gomez
parent 2309f63002
commit 9f5069cdc8

1
.gitignore vendored

@ -0,0 +1 @@
build

@ -226,7 +226,7 @@ macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -std=c++03")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wtype-limits -std=c++03")
find_package(SSE)
if (HAVE_AVX2)
@ -243,7 +243,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clan
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wtype-limits -std=c99 -D_GNU_SOURCE")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")

@ -113,7 +113,7 @@ int main(int argc, char **argv) {
uint32_t m0, m1;
float m0_value, m1_value;
uint32_t N_id_2;
uint32_t sss_idx;
int sss_idx;
struct timeval tdata[3];
int *exec_time;

@ -129,13 +129,13 @@ public:
virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
// Same with hex dump
virtual void error_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void error_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("error_hex not implemented.\n");}
virtual void warning_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void warning_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("warning_hex not implemented.\n");}
virtual void info_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void info_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("info_hex not implemented.\n");}
virtual void debug_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void debug_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("debug_hex not implemented.\n");}
protected:

@ -258,7 +258,7 @@ public:
private:
static const int MAX_CE_PAYLOAD_LEN = 8;
uint32_t lcid;
int nof_bytes;
uint32_t nof_bytes;
uint8_t* payload;
uint8_t w_payload_ce[8];
bool F_bit;

@ -103,8 +103,10 @@ void sch_pdu::parse_packet(uint8_t *ptr)
read_len += subheaders[i].size_plus_header();
}
if (pdu_len-read_len-1 >= 0) {
subheaders[nof_subheaders-1].set_payload_size(pdu_len-read_len-1);
int n_sub = pdu_len-read_len-1;
if (n_sub >= 0) {
subheaders[nof_subheaders-1].set_payload_size(n_sub);
} else {
fprintf(stderr,"Reading MAC PDU: negative payload for last subheader\n");
}
@ -584,17 +586,22 @@ int sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, read_pdu_interfa
payload = ((sch_pdu*)parent)->get_current_sdu_ptr();
// Copy data and get final number of bytes written to the MAC PDU
uint32_t sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
int sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
if (sdu_sz < 0 || sdu_sz > requested_bytes) {
if (sdu_sz < 0) {
return -1;
}
if (sdu_sz == 0) {
return 0;
}
else {
// Save final number of written bytes
nof_bytes = sdu_sz;
// Save final number of written bytes
nof_bytes = sdu_sz;
if(nof_bytes > requested_bytes) {
return -1;
}
}
((sch_pdu*)parent)->add_sdu(nof_bytes);
((sch_pdu*)parent)->update_space_sdu(nof_bytes);

@ -40,7 +40,7 @@ uint32_t long_cb = 0;
void usage(char *prog) {
printf("Usage: %s\n", prog);
printf("\t-l long_cb [Default check all]\n", long_cb);
printf("\t-l long_cb [Default %u]\n", long_cb);
}
void parse_args(int argc, char **argv) {

@ -208,7 +208,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PBCH\n", 0);
INFO("Decoding PBCH\n");
for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
ce_slot1[i] = &ce[i][SRSLTE_SLOT_LEN_RE(cell.nof_prb, cell.cp)];

Loading…
Cancel
Save