Bug 401448

Summary: Windows build is broken - '_isinf': identifier not found
Product: [Applications] kmymoney Reporter: ansgar.roeber
Component: reportsAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: ralf.habacker
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 4.8.3,5.0.3
Sentry Crash Report:

Description ansgar.roeber 2018-11-26 22:16:18 UTC
SUMMARY
https://cgit.kde.org/kmymoney.git/tree/kmymoney/plugins/views/reports/core/cashflowlist.cpp?h=5.0

_isinf replacement for std::isinf is not available for MSVC
_finite maybe usable

If only msvc 2017 is used for windows std::isinf and std::isnan should be usable.


OBSERVED RESULT
https://binary-factory.kde.org/job/KMyMoney_Release_win64/89/console
Comment 1 Ralf Habacker 2018-11-27 07:21:26 UTC
https://www.christophlassner.de/collection-of-msvc-gcc-compatibility-tricks.html mentiones the following code to provide std compatible functions for msvc < 2017.

#if defined(_MSC_VER)
#if _MSC_VER < 1800
namespace std {
  template <typename T>
  bool isnan(const T &x) { return _isnan(x); }

  template <typename T>
  bool isinf(const T &x) { return !_finite(x); }
}
#endif
#endif

Beside the option to fix this in kmymoney directly, there is also the option to add this to the KDE windows supplemental library (kdewin), which is also used by kmymoney.
Comment 2 Ralf Habacker 2018-11-27 07:38:38 UTC
(In reply to ansgar.roeber from comment #0)
> If only msvc 2017 is used for windows std::isinf and std::isnan should be
> usable.
> OBSERVED RESULT
> https://binary-factory.kde.org/job/KMyMoney_Release_win64/89/console
KDE CI and binary factory uses msvc 2017: removing the MSVC related part from https://cgit.kde.org/kmymoney.git/tree/kmymoney/plugins/views/reports/core/cashflowlist.cpp?h=5.0&id=b87e02c13e8eb027211d0e69862d9c4370653025#n83 should fix the issue at least there.
Comment 3 Ralf Habacker 2018-11-27 07:49:04 UTC
(In reply to Ralf Habacker from comment #1)
> Beside the option to fix this in kmymoney directly, there is also the option
> to add this to the KDE windows supplemental library (kdewin), which is also
> used by kmymoney.
added to kdewin version 0.6.3 - https://commits.kde.org/kdewin/072b5f49b61404b965d67e3f26df706dba228d08
Comment 4 Ralf Habacker 2018-11-27 07:53:37 UTC
Git commit 73a2c94feef3b522fa383322c726e7d1cfa80180 by Ralf Habacker.
Committed on 27/11/2018 at 07:53.
Pushed by habacker into branch '5.0'.

Fix msvc compiling issue

std::isinf() and std:isnan() is supported only for msvc >= 2017.
For msvc < 2017 related definitions has been added to kdewin
version 0.6.3.
FIXED-IN:5.0.3

M  +0    -5    kmymoney/plugins/views/reports/core/cashflowlist.cpp

https://commits.kde.org/kmymoney/73a2c94feef3b522fa383322c726e7d1cfa80180
Comment 5 Ralf Habacker 2018-11-28 10:04:40 UTC
Git commit bbc6099b458a483ed7d6c64227b8d03bbe7e6d83 by Ralf Habacker.
Committed on 28/11/2018 at 10:03.
Pushed by habacker into branch '4.8'.

Fix msvc compiling issue

std::isinf() and std:isnan() is supported only for msvc >= 2017.
For msvc < 2017 related definitions has been added to kdewin
version 0.6.3.

Backported from 5.0 branch, commit 73a2c94fe.
FIXED-IN:4.8.3, 5.0.3

M  +0    -5    kmymoney/reports/cashflowlist.cpp

https://commits.kde.org/kmymoney/bbc6099b458a483ed7d6c64227b8d03bbe7e6d83