Skip to content

Don't set __GNUC__ and friends in microsoft mode, set _MSC_VER instead #12162

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

Closed
nico opened this issue Jan 18, 2012 · 6 comments
Closed

Don't set __GNUC__ and friends in microsoft mode, set _MSC_VER instead #12162

nico opened this issue Jan 18, 2012 · 6 comments
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@nico
Copy link
Contributor

nico commented Jan 18, 2012

Bugzilla Link 11790
Resolution FIXED
Resolved on Aug 27, 2014 08:48
Version unspecified
OS Windows NT
Blocks llvm/llvm-bugzilla-archive#13707
CC @AaronBallman

Extended Description

Probably important for many projects.

Chromium for example uses this for compiler detection:

// Compiler detection.
#if defined(GNUC)
#define COMPILER_GCC 1
#elif defined(_MSC_VER)
#define COMPILER_MSVC 1
#else
#error Please add support for your compiler in build/build_config.h
#endif

...and uses that to decide whether to #include <hash_set> or <ext/hash_set.

@nico
Copy link
Contributor Author

nico commented Jan 18, 2012

(chrome workaround: change build_config.h to always set COMPILER_MSVC)

@llvmbot
Copy link
Member

llvmbot commented Jan 19, 2012

For my information, can chromium be built with mingw-gcc?

@nico
Copy link
Contributor Author

nico commented Jan 23, 2012

No, it can't. I haven't tried it myself, but a coworker tried once, and he says it doesn't work because chromium's string16 type assumes that short wchar_ts have the same type as shorts.

@AaronBallman
Copy link
Collaborator

Actually, it seems that _MSC_VER is defined. It's just that GNUC is also defined at the same time.

#if defined(_MSC_VER)
#error "MSVC defined"
#endif

#if defined(GNUC)
#error "GnuC defined"
#endif

#if defined(I_AM_NOT_DEFINED)
#error "The world is ending"
#endif

This gives two error messages: MSVC defined and GnuC defined

I think this may be a bug

@AaronBallman
Copy link
Collaborator

This is fixed in r152512

@tritao
Copy link
Mannequin

tritao mannequin commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#13707

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

3 participants