Skip to content

Conversation

@basilgello
Copy link
Contributor

  • Implement USE_OS_TZDB for Android
  • Ensure Android private functions dont show up
  • Fix unused functions on Android

... for external consumers like tests

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
@basilgello
Copy link
Contributor Author

@HowardHinnant Now no more unused functions in Android! Apart from that, tests against NDK r27b caught the following static assertion failures:

/tmp/date/test/date_test/year.pass.cpp:116:19: error: static assertion failed due to requirement 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<int, std::ratio<86400, 1>>>(year::min() / jan / 1) - std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<int, std::ratio<86400, 1>>>(1970_y / jan / 1) >= as<long long>(duration<long, std::ratio<60, 1>>::min())':
  116 |     static_assert(sys_days(year::min()/jan/1)  - sys_days(1970_y/jan/1)
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117 |         >= as<int64_t>(minutes::min()), "");
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 75%] Linking CXX executable date_test_pass_op_div_year_month_bin
[ 75%] Linking CXX executable clock_cast_test_pass_constexpr_bin
[ 75%] Built target date_test_pass_last_bin
/tmp/date/test/date_test/year.pass.cpp:130:19: error: static assertion failed due to requirement 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<int, std::ratio<86400, 1>>>(year::max() / dec / 31) - std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<int, std::ratio<86400, 1>>>(1970_y / jan / 1) <= as<long long>(duration<long, std::ratio<60, 1>>::max())':
  130 |     static_assert(sys_days(year::max()/dec/31) - sys_days(1970_y/jan/1)
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131 |         <= as<int64_t>(minutes::max()), "");
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kodi compiles and passes integration tests just fine, buut you might still find the issue interesting!

@basilgello
Copy link
Contributor Author

Reproducer:

#!/bin/sh

set -e

cd date
rm -rf build
mkdir build
cd build
cmake \
        -DCMAKE_TOOLCHAIN_FILE=/tmp/android-ndk-r27b/build/cmake/android.toolchain.cmake \
        -DANDROID_ABI=armeabi-v7a \
        -DANDROID_PLATFORM=android-21 \
        -DBUILD_TZ_LIB=ON \
        -DUSE_SYSTEM_TZ_DB=ON \
        -DENABLE_DATE_TESTING=ON \
        -DCMAKE_CXX_FLAGS=-Wall \
        -DCMAKE_CXX_FLAGS=-Wall \
        ..
make VERBOSE=1
cmake --build . --target testit -j
make test VERBOSE=1

@basilgello
Copy link
Contributor Author

You download https://dl.google.com/android/repository/android-ndk-r27b-darwin.dmg and unpack stuff so /tmp/android-ndk-r27b is NDK root directory, just in case you wanna try it out

src/tz.cpp Outdated

static
#if !defined(ANDROID) && !defined(__ANDROID__)
Wstatic
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date/src/tz.cpp:656:1: error: unknown type name 'Wstatic'; did you mean 'static'?
  656 | Wstatic
      | ^~~~~~~
      | static
1 error generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo-ed :( Fixed!

... spotted with `-Wall`

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
@HowardHinnant
Copy link
Owner

Merged (with a couple of trivial fixes): 447f5a3

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