Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/wtf/Compiler.h

Issue 805073002: just use c++ static_assert everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove gcc version check around WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 29 matching lines...) Expand all
40 /* COMPILER(CLANG) - Clang */ 40 /* COMPILER(CLANG) - Clang */
41 #if defined(__clang__) 41 #if defined(__clang__)
42 #define WTF_COMPILER_CLANG 1 42 #define WTF_COMPILER_CLANG 1
43 43
44 #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA) 44 #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
45 45
46 /* Specific compiler features */ 46 /* Specific compiler features */
47 47
48 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions) 48 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explici t_conversions)
49 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) 49 #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
50 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
51 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_asser t)
52 #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial _destructor) 50 #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial _destructor)
53 51
54 #endif 52 #endif
55 53
56 #ifndef CLANG_PRAGMA 54 #ifndef CLANG_PRAGMA
57 #define CLANG_PRAGMA(PRAGMA) 55 #define CLANG_PRAGMA(PRAGMA)
58 #endif 56 #endif
59 57
60 /* COMPILER(MSVC) - Microsoft Visual C++ */ 58 /* COMPILER(MSVC) - Microsoft Visual C++ */
61 #if defined(_MSC_VER) 59 #if defined(_MSC_VER)
62 #define WTF_COMPILER_MSVC 1 60 #define WTF_COMPILER_MSVC 1
63 #endif 61 #endif
64 62
65 /* COMPILER(GCC) - GNU Compiler Collection */ 63 /* COMPILER(GCC) - GNU Compiler Collection */
66 #if defined(__GNUC__) 64 #if defined(__GNUC__)
67 #define WTF_COMPILER_GCC 1 65 #define WTF_COMPILER_GCC 1
68 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL __) 66 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL __)
69 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) 67 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
70 #else 68 #else
71 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_ AT_LEAST(4, 1, 0). */ 69 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_ AT_LEAST(4, 1, 0). */
72 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 70 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0
73 #endif 71 #endif
74 72
75 /* Specific compiler features */ 73 /* Specific compiler features */
76 #if COMPILER(GCC) && !COMPILER(CLANG) 74 #if COMPILER(GCC) && !COMPILER(CLANG)
77 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
78 /* C11 support */
79 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
80 #endif
81 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L)
82 /* C++11 support */
83 #if GCC_VERSION_AT_LEAST(4, 3, 0)
84 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
85 #endif
86 #if GCC_VERSION_AT_LEAST(4, 5, 0)
87 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 75 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1
88 #endif
89 #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplu splus >= 201103L) */
90 #endif /* COMPILER(GCC) */ 76 #endif /* COMPILER(GCC) */
91 77
92 /* ==== Compiler features ==== */ 78 /* ==== Compiler features ==== */
93 79
94 80
95 /* ALWAYS_INLINE */ 81 /* ALWAYS_INLINE */
96 82
97 #ifndef ALWAYS_INLINE 83 #ifndef ALWAYS_INLINE
98 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) 84 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
99 #define ALWAYS_INLINE inline __attribute__((__always_inline__)) 85 #define ALWAYS_INLINE inline __attribute__((__always_inline__))
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 180 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
195 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__ 181 #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
196 #elif COMPILER(MSVC) 182 #elif COMPILER(MSVC)
197 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 183 #define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1
198 #define WTF_PRETTY_FUNCTION __FUNCSIG__ 184 #define WTF_PRETTY_FUNCTION __FUNCSIG__
199 #else 185 #else
200 #define WTF_PRETTY_FUNCTION __FUNCTION__ 186 #define WTF_PRETTY_FUNCTION __FUNCTION__
201 #endif 187 #endif
202 188
203 #endif /* WTF_Compiler_h */ 189 #endif /* WTF_Compiler_h */
OLDNEW
« no previous file with comments | « Source/wtf/Assertions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698