[A] Added more warnings to the compilation

This commit is contained in:
seleznevae 2018-11-17 11:53:03 +03:00
parent 29085eb1ff
commit 36377e4094
5 changed files with 16 additions and 8 deletions

View File

@ -58,10 +58,17 @@ else("${FORT_COMPILER}" STREQUAL "MSVC")
-Wformat=2 \
-Wno-variadic-macros \
-Wcast-align \
-Wstrict-aliasing=2 \
-Wstrict-overflow=5 \
-Wfloat-equal \
-Wwrite-strings \
")
if("${FORT_COMPILER}" STREQUAL "GNU")
set(ADDITIONAL_WARNINGS "${ADDITIONAL_WARNINGS} -Wtrampolines -Wlogical-op")
endif("${FORT_COMPILER}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -Wextra -Werror -std=c99 -Wpedantic ${ADDITIONAL_WARNINGS}")
set(ADDITIONAL_WARNINGS "${ADDITIONAL_WARNINGS} -Wuseless-cast ")
set(ADDITIONAL_WARNINGS "${ADDITIONAL_WARNINGS} ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -Wextra -Werror -std=c++11 ${ADDITIONAL_WARNINGS}")
endif("${FORT_COMPILER}" STREQUAL "MSVC")

View File

@ -667,6 +667,7 @@ fort_row_t *copy_row(fort_row_t *row);
FT_INTERNAL
fort_row_t *create_row_from_string(const char *str);
FT_PRINTF_ATTRIBUTE_FORMAT(1, 0)
FT_INTERNAL
fort_row_t *create_row_from_fmt_string(const char *fmt, va_list *va_args);
@ -2302,7 +2303,7 @@ void ft_set_cur_cell(ft_table_t *table, size_t row, size_t col)
table->cur_col = col;
}
FT_PRINTF_ATTRIBUTE_FORMAT(3, 0)
static int ft_row_printf_impl(ft_table_t *table, size_t row, const char *fmt, va_list *va)
{
#define CREATE_ROW_FROM_FMT_STRING create_row_from_fmt_string

View File

@ -588,8 +588,8 @@ public:
class table_cell_iterator
{
public:
table_cell_iterator(std::size_t row_idx, std::size_t coll_idx,Table &table)
:row_idx_(row_idx), coll_idx_(coll_idx), table_(table) {}
table_cell_iterator(std::size_t row_idx, std::size_t coll_idx, Table &tbl)
:row_idx_(row_idx), coll_idx_(coll_idx), table_(tbl) {}
table_cell_iterator& operator=(const char *str)
{
@ -607,8 +607,8 @@ public:
class table_row_iterator
{
public:
table_row_iterator(std::size_t row_idx, Table &table)
:row_idx_(row_idx), table_(table) {}
table_row_iterator(std::size_t row_idx, Table &tbl)
:row_idx_(row_idx), table_(tbl) {}
class table_cell_iterator
operator[](std::size_t coll_idx)

View File

@ -164,7 +164,7 @@ void ft_set_cur_cell(ft_table_t *table, size_t row, size_t col)
table->cur_col = col;
}
FT_PRINTF_ATTRIBUTE_FORMAT(3, 0)
static int ft_row_printf_impl(ft_table_t *table, size_t row, const char *fmt, va_list *va)
{
#define CREATE_ROW_FROM_FMT_STRING create_row_from_fmt_string

View File

@ -274,7 +274,7 @@ int wsnprint_n_string(wchar_t *buf, size_t length, size_t n, const char *str)
--k;
}
buf[n] = L'\0';
return n;
return (int)n;
}
}
}