Bug 1273048 - Add MOZ_GCC_VERSION_AT_MOST macro. r=froydnj
authorL. David Baron <dbaron@dbaron.org>
Fri, 03 Jun 2016 20:08:41 -0700
changeset 339537 efd20b79bbc525828b9a687bd14feb43c93c14d1
parent 339536 f3e63f44521d972be0e614d17bd50939a4c3c8c4
child 339538 4c3d7660fd3730f2bf51fd32f21f98063ea860c9
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1273048
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1273048 - Add MOZ_GCC_VERSION_AT_MOST macro. r=froydnj MozReview-Commit-ID: 4VjAra5B6GM
mfbt/Compiler.h
--- a/mfbt/Compiler.h
+++ b/mfbt/Compiler.h
@@ -12,22 +12,25 @@
 #define MOZ_IS_GCC 0
 #define MOZ_IS_MSVC 0
 
 #if !defined(__clang__) && defined(__GNUC__)
 
 #  undef MOZ_IS_GCC
 #  define MOZ_IS_GCC 1
    /*
-    * This macro should simplify gcc version checking. For example, to check
+    * These macros should simplify gcc version checking. For example, to check
     * for gcc 4.7.1 or later, check `#if MOZ_GCC_VERSION_AT_LEAST(4, 7, 1)`.
     */
 #  define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel)          \
      ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \
       >= ((major) * 10000 + (minor) * 100 + (patchlevel)))
+#  define MOZ_GCC_VERSION_AT_MOST(major, minor, patchlevel)           \
+     ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \
+      <= ((major) * 10000 + (minor) * 100 + (patchlevel)))
 #  if !MOZ_GCC_VERSION_AT_LEAST(4, 8, 0)
 #    error "mfbt (and Gecko) require at least gcc 4.8 to build."
 #  endif
 
 #elif defined(_MSC_VER)
 
 #  undef MOZ_IS_MSVC
 #  define MOZ_IS_MSVC 1