Skip to content

Bump CMake version and fix warning on arm64#158

Open
zhao-shihan wants to merge 2 commits into
p-ranav:masterfrom
zhao-shihan:fix/warning-on-arm64
Open

Bump CMake version and fix warning on arm64#158
zhao-shihan wants to merge 2 commits into
p-ranav:masterfrom
zhao-shihan:fix/warning-on-arm64

Conversation

@zhao-shihan
Copy link
Copy Markdown
Contributor

This pull request updates the build configuration and improves Unicode handling in the codebase. The main changes are an update to the minimum required CMake version and a fix to use the correct type for Unicode interval boundaries.

Build system update:

  • Increased the minimum required CMake version to 3.12 and simplified the project configuration in CMakeLists.txt. 3.8 is ancient.

Fix a compilation warning on ARM64:

  • Changed the type of interval::first and interval::last from int to wchar_t in both include/indicators/display_width.hpp and single_include/indicators/indicators.hpp. This fixes the following warning on ARM64:
In file included from .../include/indicators/block_progress_bar.hpp:6:
In file included from .../include/indicators/details/stream_helper.hpp:5:
.../include/indicators/display_width.hpp:86:35: warning: comparison of integers of different signs: 'wchar_t' and 'const int' [-Wsign-compare]
   86 |   if (ucs < table[0].first || ucs > table[max].last)
      |                               ~~~ ^ ~~~~~~~~~~~~~~~
.../include/indicators/display_width.hpp:86:11: warning: comparison of integers of different signs: 'wchar_t' and 'const int' [-Wsign-compare]
   86 |   if (ucs < table[0].first || ucs > table[max].last)
      |       ~~~ ^ ~~~~~~~~~~~~~~
.../include/indicators/display_width.hpp:90:13: warning: comparison of integers of different signs: 'wchar_t' and 'const int' [-Wsign-compare]
   90 |     if (ucs > table[mid].last)
      |         ~~~ ^ ~~~~~~~~~~~~~~~
.../include/indicators/display_width.hpp:92:18: warning: comparison of integers of different signs: 'wchar_t' and 'const int' [-Wsign-compare]
   92 |     else if (ucs < table[mid].first)
      |              ~~~ ^ ~~~~~~~~~~~~~~~~
4 warnings generated.

That's because wchar_t can be either signed or unsigned, depending on platform and compilation options.

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.

1 participant