The `-Wstrict-aliasing` warning issue was already fixed by someone earlier.
And for the `-Wtautological-constant-out-of-range-compare` (wordy) warning,
I replaced `val <= 4611686018427387903` assertion with `!(val >> 31 >> 31)`
expression. These expressions are equivalent but the latter is defined if
the size_t type is only 32-bits wide. Another way to think about it is that
the expression is checking if any bit after the 61st bit is set.
These tests appear to never have been used in Monero's lifetime and it would take
a Herculean effort to refactor these files to the point where they will compile.
At many points, these tests include headers which no longer exist in EPEE.
AFAIK these 4 hyphens in these comments in local_ip.h are the only non-UFT8 characters in the entire monero repo.
It tripped up a dependency script I was writing for this codebase, so now its personal.
Actions:
* Remove superfluous includes to boost/date_time, iostream, and pragma_comp_defs.h
* Include cstdio for snprintf
* Include string for std::string
* Move get_gmt_time to top of module for following step
* Use thread-safe get_gmt_time instead of unsafe gm_time in function get_internet_time_str()
* In get_time_interval_string(), add explicit (int) casts to git rid of VS4996 warnings
* In get_time_interval_string(), use snprintf instead of boost::lexical_casts and string concats
* In file epee_utils.cpp, include boost/range/iterator_range.hpp for boost::make_iterator_range.
Previously, epee_util.cpp was including some file which was including time_helper which included
a boost header which included iterator_range.hpp at some point, which allowed epee_util.cpp to
compile without an explicit include of iterator_range.hpp. I added it because I removed the boost
includes in the first step which broke epee_util.cpp.
Actions:
* Move get_ns_count(), get_tick_count(), and get_gmt_time() from misc_os_dependent.h to time_helper.h. I did this because all those functions are time-related and under the same namespace
* Remove misc_os_dependent.h because it is now empty
* Change all includes of misc_os_dependent.h to time_helper.h where appropriate
* Remove get_time_string*() from time_helper.h b/c its unused
* Remove get_time_t_from_ole_date() from time_helper.h b/c its unused
* Remove odbc_time_to_oledb_taime() from time_helper.h b/c its unused
* Refactor get_ns_count() to use std::chrono instead of 4 different implementation-specific hacks
Actions:
Remove call_sys_cmd() definition from misc_os_dependent.h b/c its unused
Remove get_thread_string_id() declaration from misc_os_dependent.h b/c its unused
Remove misc_os_dependent.cpp file b/c the only definition was get_thread_string_id()
Remove file reference to misc_os_dependent.cpp from epee/src/CMakeLists.txt b/c its now deleted
epee::copyable_atomic was only be used by one struct, cryptonote_connection_context.
This should probably eventually factored out of that class, so I left the following comment:
This class was originally from the EPEE module. It is identical in function to std::atomic<uint32_t> except
that it has copy-construction and copy-assignment defined, which means that earliers devs didn't have to write
custom copy-contructors and copy-assingment operators for the outer class, cryptonote_connection_context.
cryptonote_connection_context should probably be refactored because it is both trying to be POD-like while
also (very loosely) controlling access to its atomic members.
This was mostly the same as the other commits, but there was actually one reference to
the functions in to_nonconst_iterator.h in http_protocol_handler.inl. All the other
files modified in this commit were to remove extraneous includes of to_nonconst_iterator.h.
In http_protocol_handler.inl, to_nonsonst_iterator() (misspelled?) was used to convert a
string::const_iterator to a nonconst iterator in order to use it in a call to
string::erase(). However, this in not necessary as of C++11, so I removed the conversion
altogether.