Compiler.h (1114B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* Various compiler checks. */ 8 9 #ifndef mozilla_Compiler_h 10 #define mozilla_Compiler_h 11 12 #if !defined(__clang__) && defined(__GNUC__) 13 # define MOZ_IS_GCC 1 14 /* 15 * These macros should simplify gcc version checking. For example, to check 16 * for gcc 4.7.1 or later, check `#if MOZ_GCC_VERSION_AT_LEAST(4, 7, 1)`. 17 */ 18 # define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel) \ 19 ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \ 20 ((major) * 10000 + (minor) * 100 + (patchlevel))) 21 # define MOZ_GCC_VERSION_AT_MOST(major, minor, patchlevel) \ 22 ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) <= \ 23 ((major) * 10000 + (minor) * 100 + (patchlevel))) 24 #else 25 # define MOZ_IS_GCC 0 26 #endif 27 28 #endif /* mozilla_Compiler_h */