Skip to content

Commit

Permalink
Fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Oct 9, 2023
1 parent 24d7062 commit b043358
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Sources/Shared/Containers/DateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
# include <atomic>
#endif

#if defined(DEATH_TARGET_SWITCH) || (defined(__MINGW32_TOOLCHAIN__) && defined(__STRICT_ANSI__))
// These two are excluded from headers for some reason, define them here
extern "C" void tzset(void);
extern long _timezone;
#endif

#define MONTHS_IN_YEAR 12
#define SEC_PER_MIN 60
#define MIN_PER_HOUR 60
Expand Down Expand Up @@ -125,22 +131,18 @@ namespace Death::Containers
# if !defined(DEATH_TARGET_WINDOWS_RT)
// In any case we must initialize the time zone before using it, try to do it only once
static bool _tzSet = (_tzset(), true);
(void)_tzSet;
# endif

long t;
_get_timezone(&t);
return t;
#elif defined(DEATH_TARGET_SWITCH)
// This doesn't seem to be supported on Switch
return 0;
#else
// In any case we must initialize the time zone before using it, try to do it only once
static bool _tzSet = (tzset(), true);
(void)_tzSet;

# if defined(DEATH_TARGET_MINGW)
# if defined(__MINGW32_TOOLCHAIN__) && defined(__STRICT_ANSI__)
extern long _timezone;
# endif
# if defined(DEATH_TARGET_MINGW) || defined(DEATH_TARGET_SWITCH)
return _timezone;
# else // Unknown platform - assume it has timezone variable
return timezone;
Expand Down
1 change: 1 addition & 0 deletions cmake/ncine_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ extern \"C\" int(*fooDispatcher())() {
int foo() __attribute__((ifunc(\"fooDispatcher\")));
int main() { return foo() - 42; }\
" _DEATH_CPU_CAN_USE_IFUNC)
set(CMAKE_REQUIRED_QUIET OFF)
if(_DEATH_CPU_CAN_USE_IFUNC)
set(_DEATH_CPU_USE_IFUNC_DEFAULT ON)
# On GCC 4.8, if --coverage or -fprofile-arcs is enabled, the ifunc dispatchers cause a segfault.
Expand Down

0 comments on commit b043358

Please sign in to comment.