Skip to content

Guard against duplicate definitions of __EXTENSIONS__ #2082

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

Bill-Sommerfeld
Copy link
Contributor

For whatever reason, g++ on illumos predefines __EXTENSIONS__.

gnucash defines it in four places; it's guarded with an #ifdef in config.h, but three other files define it unconditionally in a way that clashes with the predefinition, resulting in compile errors like:

/z/ws/gnucash-upstream/libgnucash/engine/gnc-date.cpp:28:9: error: "__EXTENSIONS__" redefined [-Werror]
   28 | #define __EXTENSIONS__
      |         ^~~~~~~~~~~~~~
<built-in>: note: this is the location of the previous definition

The fix is to change the other three files to match config.h.

@jralls
Copy link
Member

jralls commented May 6, 2025

Meh. __EXTENSIONS__ seems to be a SunOS/Solaris thing. Let's just get rid of them.

@jralls
Copy link
Member

jralls commented May 6, 2025

I just saw your wiki account application explaining that openindiana is an open source solaris. The reason for __EXTENSIONS__ is explained in standards(5) under "feature test macros".

@Bill-Sommerfeld
Copy link
Contributor Author

Bill-Sommerfeld commented May 6, 2025

I understand why __EXTENSIONS__ exists in the system headers (looks like it was also used on hp-ux). What I'm not sure of yet is why g++ (but not gcc) is always setting it.

Dropping the #define __EXTENSIONS__ from these three files and from config.h makes sense if it can land in CFLAGS instead. I'll revise this pull request accordingly..

@jralls
Copy link
Member

jralls commented May 6, 2025

It will also need to come out of CMakeLists.txt.

Test thoroughly, it's not going to have anything to do with modern Unix that I can test.

@jralls
Copy link
Member

jralls commented May 15, 2025

I'll revise this pull request accordingly..

Ping?

@Bill-Sommerfeld
Copy link
Contributor Author

Will be getting back to this shortly (had it mostly ready when something else captured my attention..)

move it to compiler options if on a platform that needs it.
@code-gnucash-org code-gnucash-org merged commit 78b1bd2 into Gnucash:stable May 15, 2025
4 checks passed
@jralls
Copy link
Member

jralls commented May 15, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants