Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard __has_attribute for compilers that don't support it #199

Merged
merged 2 commits into from
Aug 17, 2021

Conversation

lgritz
Copy link
Contributor

@lgritz lgritz commented Aug 14, 2021

Fixes #154

Signed-off-by: Larry Gritz lg@larrygritz.com

@lgritz lgritz changed the title Guard for compilers that don't support it Guard __has_include for compilers that don't support it Aug 14, 2021
@lgritz lgritz changed the title Guard __has_include for compilers that don't support it Guard __has_attribute for compilers that don't support it Aug 14, 2021
Signed-off-by: Larry Gritz <lg@larrygritz.com>
@glm-smaraux
Copy link

glm-smaraux commented Aug 16, 2021

Hello,
I tried using this patch under gcc 4.8.5. During build, I still have the same errors, the error "arrow" pointing the first parenthesis of __has_attribute(

/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/source/Imath/build_gcc48/config/ImathConfig.h:159:49: error: missing binary operator before token "("
# if defined(__has_attribute) && __has_attribute(__type_visibility__)

A potential fix would be to test for GNUC >= 5

# if !defined(__GNUC__) || __GNUC__ >= 5
# if __has_attribute(__type_visibility__)
#    define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE __attribute__ ((__type_visibility__ ("default")))
#  endif
# endif

This works OK for gcc 4.8

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz
Copy link
Contributor Author

lgritz commented Aug 16, 2021

Pushed an update, can you try it out?

@glm-smaraux
Copy link

All good for me !

@lgritz
Copy link
Contributor Author

lgritz commented Aug 16, 2021

Oh, good, thanks for checking.

Sometimes the #if defined(foo) && foo idiom works and sometimes it doesn't. Depends on the compiler.

Copy link
Member

@cary-ilm cary-ilm left a comment

Choose a reason for hiding this comment

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

LGTM

@cary-ilm cary-ilm merged commit b5faed3 into AcademySoftwareFoundation:master Aug 17, 2021
@lgritz lgritz deleted the lg-has_attrib branch August 25, 2021 16:42
cary-ilm pushed a commit to cary-ilm/Imath that referenced this pull request Aug 30, 2021
…oftwareFoundation#199)

* Guard `__has_attribute` for compilers that don't support it

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* take 2

Signed-off-by: Larry Gritz <lg@larrygritz.com>
cary-ilm pushed a commit that referenced this pull request Sep 1, 2021
* Guard `__has_attribute` for compilers that don't support it

Signed-off-by: Larry Gritz <lg@larrygritz.com>

* take 2

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@cary-ilm cary-ilm added the v3.1.3 label Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't compile with gcc 4.*
4 participants