This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 480 - Compiler error using GCC 4.4.3 (Android NDK toolchain) in Core/MathFunctions.h
Summary: Compiler error using GCC 4.4.3 (Android NDK toolchain) in Core/MathFunctions.h
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.1
Hardware: All Other UNIX-like
: Normal major
Assignee: Nobody
URL:
Whiteboard:
Keywords:
: 484 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-26 13:13 UTC by Michael Hofmann
Modified: 2019-12-04 11:44 UTC (History)
3 users (show)



Attachments

Description Michael Hofmann 2012-06-26 13:13:02 UTC
When compiling a translation unit that includes Eigen/Core using GCC 4.4.3 (in this case the standard compiler in the Android NDK toolchain, r8), the following compile error occurs:

In file included from ../Eigen/Core:267,
                 from .......:
../Eigen/src/Core/MathFunctions.h:848: error: expected unqualified-id before 'sizeof'
../Eigen/src/Core/MathFunctions.h:848: error: expected ')' before 'sizeof'
../Eigen/src/Core/MathFunctions.h:848: error: expected ')' before 'sizeof'

Line 848 is the definition of template<typename T> bool isfinite(const T& x).
This fails to compile since isfinite() is defined as a macro in the toolchain's math.h as follows:

#define isfinite(x)                 \
     ((sizeof (x) == sizeof (float)) ? __isfinitef(x)    \
     : (sizeof (x) == sizeof (double)) ? __isfinite(x)   \
     : __isfinitel(x))

Two possible solutions could be to either #undef isfinite just before the function template definition or, preferably, to choose another name for the function template (e.g. is_finite).
Comment 1 Gael Guennebaud 2012-07-05 17:18:26 UTC
See this thread in the forum:

http://forum.kde.org/viewtopic.php?f=74&t=102930&p=225608&hilit=isfinite#p225608

What we can do is to protect isfinite with parenthesis.
Comment 2 Gael Guennebaud 2012-07-05 17:23:36 UTC
Fixed:

https://bitbucket.org/eigen/eigen/changeset/1fc8deb4fedb/
changeset:   1fc8deb4fedb
user:        ggael
date:        2012-07-05 17:22:25
summary:     Fix bug 480: workaround the Android NDK defining isfinite as a macro

https://bitbucket.org/eigen/eigen/changeset/c8e060b47beb/
changeset:   c8e060b47beb
branch:      3.1
user:        ggael
date:        2012-07-05 17:22:25
summary:     Fix bug 480: workaround the Android NDK defining isfinite as a macro
(transplanted from 1fc8deb4fedba96f7e5a470edc314985cac4c7d3)
Comment 3 Christoph Hertzberg 2012-12-20 17:00:04 UTC
*** Bug 484 has been marked as a duplicate of this bug. ***
Comment 4 Nobody 2019-12-04 11:44:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/480.

Note You need to log in before you can comment on or make changes to this bug.