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

Use gcc broken friend workaround also with clang8 #6933

Merged
merged 3 commits into from Jul 14, 2020

Conversation

@tcamargo
Copy link
Contributor

@tcamargo tcamargo commented Jul 9, 2020

"Fix"

In file included from ../../../../../src/emu/emu.h:103:
/Users/buildbot/buildbot/osx/libretro-mame/build/projects/retro/mame/gmake-osx-clang/../../../../../src/emu/devcb.h:1102:12: error: 'consume' is a protected member of 'devcb_write<unsigned char, '\xFF'>::builder_base'
                { m_sink.consume(); }
                         ^

full build log: http://paste.libretro.com/215612

Feedback welcome about best way to implement the compiler check.

"Fix":
In file included from ../../../../../src/emu/emu.h:103:
/Users/buildbot/buildbot/osx/libretro-mame/build/projects/retro/mame/gmake-osx-clang/../../../../../src/emu/devcb.h:1102:12: error: 'consume' is a protected member of 'devcb_write<unsigned char, '\xFF'>::builder_base'
                { m_sink.consume(); }
                         ^
@rb6502
Copy link
Contributor

@rb6502 rb6502 commented Jul 10, 2020

I'd prefer completely separate GCC and Clang checks, but this is fine otherwise.

@tcamargo
Copy link
Contributor Author

@tcamargo tcamargo commented Jul 10, 2020

@rb6502 Do you mean I should replicate the whole block for clang?

@smf-
Copy link
Member

@smf- smf- commented Jul 10, 2020

@ajrhacker
Copy link
Contributor

@ajrhacker ajrhacker commented Jul 10, 2020

@smf-
Copy link
Member

@smf- smf- commented Jul 11, 2020

@rb6502
Copy link
Contributor

@rb6502 rb6502 commented Jul 11, 2020

I want it to check for Clang, then check the Clang version if it's Clang. If it's not check for GCC and do the existing GCC version check. That way there's no chance of checking undefined or faked compatibility version numbers and it's easier to read.

@tcamargo
Copy link
Contributor Author

@tcamargo tcamargo commented Jul 12, 2020

So, let's be verbose:

#if defined(__GNUC__)
#if (__GNUC__ >= 8)
#define MAME_DEVCB_GNUC_BROKEN_FRIEND 1
#endif // (__GNUC__ >= 8)
#endif // defined(__GNUC__)

#if defined(__clang__)
#if (__clang_major__ == 8)
#define MAME_DEVCB_GNUC_BROKEN_FRIEND 1
#endif // (__clang__ == 8)
#endif // defined(__clang__)
@rb6502
Copy link
Contributor

@rb6502 rb6502 commented Jul 12, 2020

I'd prefer it only do the GNUC check if it's not Clang, since Clang does set GNUC as @smf noted. But almost there :)

tcamargo added 2 commits Jul 13, 2020
@rb6502 rb6502 merged commit c7adaa8 into mamedev:master Jul 14, 2020
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
@smf-
Copy link
Member

@smf- smf- commented Jul 14, 2020

@tcamargo
Copy link
Contributor Author

@tcamargo tcamargo commented Jul 14, 2020

This still ignores that clang defines both GNUC & clang, which is why the original has #ifdefined(GNUC) && !defined(clang)

On 12/07/2020 16:12, Tiago wrote: So, let's be verbose: |#if defined(GNUC) #if (GNUC >= 8) #define MAME_DEVCB_GNUC_BROKEN_FRIEND 1 #endif // (GNUC >= 8) #endif // defined(GNUC) #if defined(clang) #if (clang_major == 8) #define MAME_DEVCB_GNUC_BROKEN_FRIEND 1 #endif // (clang == 8) #endif // defined(clang_major) |

Already corrected. ;) Thx for the feedback!

@tcamargo tcamargo deleted the tcamargo:clang8-fix branch Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.