Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings on ARM platform #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

travishaagen
Copy link

@travishaagen travishaagen commented Feb 5, 2020

Fix compiler warnings on ARM platform. Was building on a Raspberry Pi 3 running 64-bit Ubuntu.

I guess char defaults to unsigned char on ARM, and it didn't like the implicit double casts.

/XXX/loguru.cpp: In function ‘void loguru::escape(std::string&, const string&)’:
/XXX/loguru.cpp:522:15: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  522 |    else if (0 <= c && c < 0x20) { // ASCI control character:
      |             ~~^~~~
/XXX/loguru.cpp: In function ‘void loguru::print_preamble(char*, size_t, loguru::Verbosity, const char*, unsigned int)’:
/XXX/loguru.cpp:1192:21: error: conversion from ‘long int’ to ‘double’ may change value [-Werror=conversion]
 1192 |   auto uptime_sec = uptime_ms / 1000.0;
      |                     ^~~~~~~~~
/XXX/loguru.cpp: In destructor ‘loguru::LogScopeRAII::~LogScopeRAII()’:
/XXX/loguru.cpp:1443:34: error: conversion from ‘long long int’ to ‘double’ may change value [-Werror=conversion]
 1443 |    auto duration_sec = (now_ns() - _start_time_ns) / 1e9;
      |                        ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/XXX/loguru.cpp: In function ‘loguru::Text loguru::ec_to_text(char)’:
/XXX/loguru.cpp:1684:14: error: comparison is always true due to limited range of data type [-Werror=type-limits]
 1684 |   else if (0 <= c && c < 0x20) {
      |            ~~^~~~

@virtuosonic
Copy link

I confirm I also get the error comparison is always true due to limited range of data type with gcc 11 on raspberry pi 3 on lines 518 and 1665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants