Bug 836078 - Replace all gcc __GNUC__ version checks with MOZ_GCC_VERSION_AT_LEAST macro. r=dvander

This commit is contained in:
Stephen Kraemer 2013-05-01 15:45:05 -04:00
parent f8afbc7973
commit 7b93b707c5
5 changed files with 49 additions and 6 deletions

View File

@ -9,6 +9,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/Compiler.h"
#include "mozilla/Scoped.h"
#include <stdlib.h>
@ -229,8 +230,21 @@ __BitScanReverse64(unsigned __int64 val)
# define js_bitscan_clz64(val) __BitScanReverse64(val)
# define JS_HAS_BUILTIN_BITSCAN64
#endif
#elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#elif MOZ_IS_GCC
#if MOZ_GCC_VERSION_AT_LEAST(3, 4, 0)
# define USE_BUILTIN_CTZ
#endif
#elif defined(__clang__)
#if __has_builtin(__builtin_ctz)
# define USE_BUILTIN_CTZ
#endif
#endif
#if defined(USE_BUILTIN_CTZ)
# define js_bitscan_ctz32(val) __builtin_ctz(val)
# define js_bitscan_clz32(val) __builtin_clz(val)
# define JS_HAS_BUILTIN_BITSCAN32
@ -240,6 +254,8 @@ __BitScanReverse64(unsigned __int64 val)
# define JS_HAS_BUILTIN_BITSCAN64
# endif
# undef USE_BUILTIN_CTZ
#endif
/*

View File

@ -12,6 +12,7 @@
#define jsutil_h___
#include "mozilla/Attributes.h"
#include "mozilla/Compiler.h"
#include "mozilla/GuardObjects.h"
#include "js/Utility.h"
@ -370,7 +371,9 @@ typedef size_t jsbitmap;
{ expr; } \
_Pragma("clang diagnostic pop") \
JS_END_MACRO
#elif (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#elif MOZ_IS_GCC
#if MOZ_GCC_VERSION_AT_LEAST(4, 6, 0)
# define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
JS_BEGIN_MACRO \
_Pragma("GCC diagnostic push") \
@ -378,7 +381,10 @@ typedef size_t jsbitmap;
expr; \
_Pragma("GCC diagnostic pop") \
JS_END_MACRO
#else
#endif
#endif
#if !defined(JS_SILENCE_UNUSED_VALUE_IN_EXPR)
# define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
JS_BEGIN_MACRO \
expr; \

View File

@ -9,6 +9,8 @@
#define mozilla_Compiler_h_
#if !defined(__clang__) && defined(__GNUC__)
#define MOZ_IS_GCC 1
/*
* This macro should simplify gcc version checking. For example, to check
* for gcc 4.5.1 or later, check `#ifdef MOZ_GCC_VERSION_AT_LEAST(4, 5, 1)`.
@ -19,6 +21,11 @@
#if !MOZ_GCC_VERSION_AT_LEAST(4, 4, 0)
# error "mfbt (and Gecko) require at least gcc 4.4 to build."
#endif
#else
#define MOZ_IS_GCC 0
#endif
#endif /* mozilla_Compiler_h_ */

View File

@ -50,6 +50,8 @@
#include "updatelogging.h"
#include "mozilla/Compiler.h"
// Amount of the progress bar to use in each of the 3 update stages,
// should total 100.0.
#define PROGRESS_PREPARE_SIZE 20.0f
@ -119,12 +121,20 @@ static bool sUseHardLinks = true;
// This variable lives in libbz2. It's declared in bzlib_private.h, so we just
// declare it here to avoid including that entire header file.
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
#define BZ2_CRC32TABLE_UNDECLARED
#if MOZ_IS_GCC
#if MOZ_GCC_VERSION_AT_LEAST(3, 3, 0)
extern "C" __attribute__((visibility("default"))) unsigned int BZ2_crc32Table[256];
#undef BZ2_CRC32TABLE_UNDECLARED
#endif
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
extern "C" __global unsigned int BZ2_crc32Table[256];
#else
#undef BZ2_CRC32TABLE_UNDECLARED
#endif
#if defined(BZ2_CRC32TABLE_UNDECLARED)
extern "C" unsigned int BZ2_crc32Table[256];
#undef BZ2_CRC32TABLE_UNDECLARED
#endif
static unsigned int

View File

@ -7,14 +7,18 @@
#include "xptcprivate.h"
#include "mozilla/Compiler.h"
#if !defined(__arm__) && !(defined(LINUX) || defined(ANDROID))
#error "This code is for Linux ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent."
#endif
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) \
#if MOZ_IS_GCC
#if MOZ_GCC_VERSION_AT_LEAST(4, 5, 0) \
&& defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP) && !defined(__ARM_PCS)
#error "Can't identify floating point calling conventions.\nPlease ensure that your toolchain defines __ARM_PCS or __ARM_PCS_VFP."
#endif
#endif
#ifndef __ARM_PCS_VFP