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

fix gcc build with -std=c++11 on i386 #58

Closed
wants to merge 1 commit into from

Conversation

mkubecek
Copy link
Contributor

After commit 2f3dc8b ("Added -std=c++11 flag to Linux builds."),
i386 (32-bit) linux builds started to fail with "#error Define FB_CPU
for your platform". This is because gcc doesn't define "i386" macro with
-std=c++11, only "i386". While current gcc seems to define both
macros without -std=c++11, let's play it safe and check for both.

After commit 2f3dc8b ("Added -std=c++11 flag to Linux builds."),
i386 (32-bit) linux builds started to fail with "#error Define FB_CPU
for your platform". This is because gcc doesn't define "i386" macro with
-std=c++11, only "__i386__". While current gcc seems to define both
macros without -std=c++11, let's play it safe and check for both.
@asfernandes
Copy link
Member

Wouldn't it much simple to do instead:

#if !defined(i386) && defined(__i386__)
#define i386 __i386__
#endif

?

@AlexPeshkoff
Copy link
Member

For some other HW we have own define (like -DARM, -DAMD64). May be it will be better going this way for x86 too - instead of guessing what else define will be changed by compiler?

@mkubecek
Copy link
Contributor Author

We already define "I386" in src/common/common.h anyway so doing this outside of the source (like we do for AMD64) and checking it everywhere would make sense.

@aafemt
Copy link
Contributor

aafemt commented Oct 24, 2016

Using external macros will tie us to the death with autoconf for recognizing platform/HW. Autoconf was good 15 years ago, but now GCC has wider set of macros for this. According to standard, these macros must have two underscores in the begin and end. Macros without them are deprecated. If we are changing sources to use new standard, we must use new macros.

@mariuz
Copy link
Member

mariuz commented Nov 1, 2016

I would go with a more readable solution

if defined(__i386__)
#define ARCH_X86_32
#endif
if defined(__x86_64__)
#define ARCH_X86_64
#endif

But we all know that I386 is x86_32 and AMD64 is x86_64 so i guess this can be merged

http://stackoverflow.com/a/152034/66242

@mkubecek
Copy link
Contributor Author

Obsoleted by commit 4107794

@mkubecek mkubecek closed this May 11, 2017
@mkubecek mkubecek deleted the mk/4.0/cpp11i386 branch May 11, 2017 08:13
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.

5 participants