Skip to content

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

Closed

Description

@nico
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.

Activity

  1. nico commented on Jan 18, 2012

    @nico
    ContributorAuthor

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

  2. llvmbot commented on Jan 19, 2012

    @llvmbot
    Member

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

  3. nico commented on Jan 23, 2012

    @nico
    ContributorAuthor

    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.

  4. AaronBallman commented on Feb 19, 2012

    @AaronBallman
    Contributor

    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

  5. AaronBallman commented on Mar 13, 2012

    @AaronBallman
    Contributor

    This is fixed in r152512

  6. tritao commented on Nov 26, 2021

    tritaomannequin
    Mannequin

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

  7. added a commit that references this issue on Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions