[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] MinGW-w64 gcc-7.2 -Wconversion warning in wx
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] MinGW-w64 gcc-7.2 -Wconversion warning in wx |
Date: |
Tue, 6 Mar 2018 16:52:42 +0100 |
On Sat, 3 Mar 2018 01:38:44 +0000 Greg Chicares <address@hidden> wrote:
GC> I'll turn this warning off for now with '-Wno-conversion', because
GC> it's triggered here in the version of wx we're currently using:
GC>
GC> /opt/lmi/local/include/wx-3.1/wx/gdicmn.h:322:21: error: conversion to
'float' from 'int' may alter its value [-Werror=conversion]
GC> { x = (int)(x*xscale); y = (int)(y*yscale); return *this; }
GC> ^
GC> /opt/lmi/local/include/wx-3.1/wx/gdicmn.h:322:42: error: conversion to
'float' from 'int' may alter its value [-Werror=conversion]
GC> { x = (int)(x*xscale); y = (int)(y*yscale); return *this; }
GC> ^
GC>
GC> It would be nice to fix that (if it hasn't already been fixed in
GC> a more recent version) because this warning is triggered by some
GC> code in lmi (which I haven't investigated yet).
This warning will be fixed once https://github.com/wxWidgets/wxWidgets/pull/754
is merged (which I'll do soon), but there are many other -Wconversion
warnings in lmi code itself, at least when building with autotools-based
system. First, there were many, many -Wfloat-conversion warnings, e.g.
ihs_acctval.cpp:1122:45: error: conversion to ‘double’ from ‘long double’ may
alter its value [-Werror=float-conversion]
double const z = material_difference(MinInitPrem(),
InitAnnPlannedPrem_);
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
so I had to add -Wno-float-conversion to the compilation flags. After this
only the following warnings remain:
facets.cpp: In instantiation of ‘static const mask*
{anonymous}::C_is_not_whitespace_ctype<C>::get_table() [with unsigned char C =
32; std::ctype_base::mask = short unsigned int]’:
facets.cpp:74:40: required from
‘{anonymous}::C_is_not_whitespace_ctype<C>::C_is_not_whitespace_ctype() [with
unsigned char C = 32]’
facets.cpp:90:22: required from ‘const std::locale&
{anonymous}::locale_with_facet() [with Facet =
{anonymous}::C_is_not_whitespace_ctype<32>]’
facets.cpp:100:62: required from here
facets.cpp:82:19: error: conversion to ‘std::ctype_base::mask {aka short
unsigned int}’ from ‘int’ may alter its value [-Werror=conversion]
rc[C] &= ~std::ctype_base::space;
round_glibc.cpp: In function ‘long double roundl(long double)’:
round_glibc.cpp:389:25: error: conversion to ‘short int’ from ‘int’ may alter
its value [-Werror=conversion]
round_glibc.cpp:222:30:
iw_u.parts.sign_exponent = (exp); \
~~~~~
round_glibc.cpp:389:25:
SET_LDOUBLE_WORDS (x, se, i0, i1);
round_glibc.cpp:222:31: note: in definition of macro ‘SET_LDOUBLE_WORDS’
iw_u.parts.sign_exponent = (exp); \
^~~
wx_utility.cpp: In function ‘wxDateTime ConvertDateToWx(const calendar_date&)’:
wx_utility.cpp:123:22: error: conversion to ‘wxDateTime::wxDateTime_t {aka
short unsigned int}’ from ‘int’ may alter its value [-Werror=conversion]
(lmi_date.day()
~~~~~~~~~~~~^~
In file included from main_cli.cpp:46:0:
timer.hpp: In instantiation of ‘AliquotTimer<F>& AliquotTimer<F>::operator()()
[with F = std::_Bind<illustrator(const char*, Input)>]’:
timer.hpp:278:43: required from ‘AliquotTimer<F> TimeAnAliquot(F, double)
[with F = std::_Bind<illustrator(const char*, Input)>]’
main_cli.cpp:139:63: required from here
timer.hpp:216:14: error: conversion to ‘double’ from ‘elapsed_t {aka long long
unsigned int}’ may alter its value [-Werror=conversion]
;now < expiry_min || j < 100 && now < expiry_max
~~~~^~~~~~~~~~~~
timer.hpp:216:45: error: conversion to ‘double’ from ‘elapsed_t {aka long long
unsigned int}’ may alter its value [-Werror=conversion]
;now < expiry_min || j < 100 && now < expiry_max
~~~~^~~~~~~~~~~~
timer.hpp:229:26: error: conversion to ‘double’ from ‘elapsed_t {aka long long
unsigned int}’ may alter its value [-Werror=conversion]
unit_time_ = minimum / dbl_freq;
~~~~~~~~^~~~~~~~~~
rate_table.cpp: In member function ‘void
binary_format::writer::write({anonymous}::enum_soa_field, const
std::experimental::fundamentals_v1::optional<std::__cxx11::basic_string<char>
>&)’:
rate_table.cpp:528:69: error: conversion to ‘uint16_t {aka short unsigned int}’
from ‘std::__cxx11::basic_string<char>::size_type {aka unsigned int}’ may alter
its value [-Werror=conversion]
do_write_record_header(soa_fields[field].record_type, length);
^
rate_table.cpp: In member function ‘void
text_format::writer::write_values(const std::vector<double>&, const
std::experimental::fundamentals_v1::optional<short unsigned int>&, const
std::experimental::fundamentals_v1::optional<short unsigned int>&, const
std::experimental::fundamentals_v1::optional<short unsigned int>&, const
std::experimental::fundamentals_v1::optional<short unsigned int>&, const
std::experimental::fundamentals_v1::optional<short unsigned int>&)’:
rate_table.cpp:655:58: error: conversion to ‘uint16_t {aka short unsigned int}’
from ‘int’ may alter its value [-Werror=conversion]
for(std::uint16_t age = *max_select_age + period + 1; age <= *max_age;
++age)
~~~~~~~~~~~~~~~~~~~~~~~~~^~~
rate_table.cpp: In member function ‘double
soa_v3_format::table_impl::parse_single_value(const char*, const char*&, int)’:
rate_table.cpp:1560:29: error: conversion to ‘double’ from ‘long long unsigned
int’ may alter its value [-Werror=conversion]
return res_int_part.num;
~~~~~~~~~~~~~^~~
rate_table.cpp: In member function ‘void
soa_v3_format::table_impl::parse_values(std::istream&, int&)’:
rate_table.cpp:1776:25: error: conversion to ‘short unsigned int’ from ‘int’
may alter its value [-Werror=conversion]
age += *select_period_;
^~~~~~~~~~~~~~
rate_table.cpp: In member function ‘void soa_v3_format::table_impl::validate()’:
rate_table.cpp:1855:72: error: conversion to ‘uint16_t {aka short unsigned
int}’ from ‘std::size_t {aka unsigned int}’ may alter its value
[-Werror=conversion]
std::uint16_t required_num_decimals =
deduce_number_of_decimals(values_);
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
rate_table.cpp: In instantiation of ‘T {anonymous}::get_value_or(const
std::experimental::fundamentals_v1::optional<_Tp>&, U) [with T = short unsigned
int; U = int]’:
rate_table.cpp:618:37: required from here
rate_table.cpp:178:14: error: conversion to ‘short unsigned int’ from ‘int’ may
alter its value [-Werror=conversion]
return o ? *o : v;
~~^~~~~~~~
None of them look really difficult to fix, but I'm not sure if it's worth
doing this, what do you think?
VZ