Bug 94761

Summary: SplashOutputDev error: 'isfinite' was not declared in this scope
Product: poppler Reporter: Torsten Seemann <torsten.seemann>
Component: splash backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: kenya888.en
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: poppler-c++11.patch

Description Torsten Seemann 2016-03-30 21:19:45 UTC
Compile time error using gcc 5.3, maybe needs std:: mamespace prefix now?

configure and make logs here: 
https://gist.github.com/facb9b4ab4bc3bf614432e4779250c26

error:

SplashOutputDev.cc: In member function 'virtual void SplashOutputDev::drawImageMask(GfxState*, Object*, Stream*, i
nt, int, GBool, GBool, GBool)':
SplashOutputDev.cc:2894:25: error: 'isfinite' was not declared in this scope
     if (!isfinite(ctm[i])) return;
                         ^
SplashOutputDev.cc:2894:25: note: suggested alternative:
In file included from /bio/linuxbrew/Cellar/gcc/5.3.0/include/c++/5.3.0/random:38:0,
                 from /bio/linuxbrew/Cellar/gcc/5.3.0/include/c++/5.3.0/bits/stl_algo.h:66,
                 from /bio/linuxbrew/Cellar/gcc/5.3.0/include/c++/5.3.0/algorithm:62,
                 from SplashOutputDev.cc:77:
/bio/linuxbrew/Cellar/gcc/5.3.0/include/c++/5.3.0/cmath:601:5: note:   'std::isfinite'
     isfinite(_Tp __x)
     ^
Comment 1 Albert Astals Cid 2016-03-31 20:17:42 UTC
isfinite is a bit of a mess, it's new in C++11 and C99 but we compile in neither of them so technically it should have always failed but it worked because the compiler was a bit less strict, now it doesn't compile for you.

Can you confirm if adding std:: fixes it? It should still fail since it's still not C++11 but maybe that's the new "less strict" mode for the newer gcc.
Comment 2 Takahiro HASHIMOTO 2016-04-25 07:52:27 UTC
Created attachment 123233 [details] [review]
poppler-c++11.patch
Comment 3 Takahiro HASHIMOTO 2016-04-25 07:52:36 UTC
I've confirmed std::isfinite works fine with GCC 5.3.0 -std=c++11 option.
I've attached the patch to fix this issue with minimal compatibility effect.

BTW Qt5.7 requires C++11 for poppler-qt5. This is why we see this issue.
Comment 4 Albert Astals Cid 2016-04-25 22:59:52 UTC
What i am interested is if just adding std:: works, not this bigger patch you posted.
Comment 5 Takahiro HASHIMOTO 2016-04-26 16:02:53 UTC
Tried. Works fine by just replacing isfinte with std::isfinte.

[My Environment]
 Gentoo Linux
 kernel 4.5.1
 gcc 5.3.0
 poppler latest
 Qt 5.7 branch

[poppler consigure options]

Building poppler with support for:
  font configuration:  fontconfig
  splash output:       yes
  cairo output:        no
  qt4 wrapper:         no
  qt5 wrapper:         yes
  glib wrapper:        no (requires cairo output)
    introspection:     no
  cpp wrapper:         no
  use gtk-doc:         no
  use libjpeg:         yes
  use libpng:          yes
  use libtiff:         yes
  use zlib compress:   yes
  use zlib uncompress: no
  use nss:             yes
  use libcurl:         no
  use libopenjpeg:     yes
      with openjpeg1
  use cms:             yes
      with lcms2
  command line utils:  yes


Should we consider another platform compatibility?

poppler/SplashOutputDev.cc

  85 #ifdef _MSC_VER
  86 #include <float.h>
  87 #define isfinite(x) _finite(x)
  88 #endif
  89
  90 #ifdef __sun
  91 #include <ieeefp.h>
  92 #ifndef isfinite
  93 #define isfinite(x) finite(x)
  94 #endif
  95 #endif
Comment 6 Albert Astals Cid 2016-04-26 22:17:59 UTC
Ok, i went with your patch from comment #3
Comment 7 Takahiro HASHIMOTO 2016-04-27 11:04:45 UTC
Thanks for your quick action:)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.