Commit 9c098a0d authored by Ivan Krasin's avatar Ivan Krasin Committed by Commit Bot

Do not throw a preprocessor error, if COMPILER_GCC is not defined.

build/build_config.h defines one of two macros:

https://cs.chromium.org/chromium/src/build/build_config.h
// 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 in the most of the case, the following checks are performed:

#if defined(COMPILER_GCC)
// Do something.
#elif defined(COMPILER_MSVC)
// Do something else.
#else
// Do something completely else.
#endif

There's one use in base/compiler_specific.h that violates this
convention, as it tests:

#if COMPILER_GCC && defined(NDEBUG)
#define ALWAYS_INLINE inline __attribute__((__always_inline__))
#elif COMPILER_MSVC && defined(NDEBUG)
#define ALWAYS_INLINE __forceinline
#else
#define ALWAYS_INLINE inline
#endif

That leads to a preprocessor error on Windows. While this error is not
triggered in Chromium, it can be reproduced, if link WebRTC Native Code
with //base shipped as a part of their checkout.

BUG=chromium:871039

Change-Id: I868b4a47a574fba48e7d2743cd64ace99ea64940
Reviewed-on: https://chromium-review.googlesource.com/1162343Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Ivan Krasin <krasin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580770}
parent d688e4b7
...@@ -77,9 +77,9 @@ ...@@ -77,9 +77,9 @@
#define NOINLINE #define NOINLINE
#endif #endif
#if COMPILER_GCC && defined(NDEBUG) #if defined(COMPILER_GCC) && defined(NDEBUG)
#define ALWAYS_INLINE inline __attribute__((__always_inline__)) #define ALWAYS_INLINE inline __attribute__((__always_inline__))
#elif COMPILER_MSVC && defined(NDEBUG) #elif defined(COMPILER_MSVC) && defined(NDEBUG)
#define ALWAYS_INLINE __forceinline #define ALWAYS_INLINE __forceinline
#else #else
#define ALWAYS_INLINE inline #define ALWAYS_INLINE inline
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment