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

Side by Side Diff: src/base/compiler-specific.h

Issue 1877823003: Revert of Fix printf formats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months 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 | « src/ast/prettyprinter.cc ('k') | src/base/format-macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_ 5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_
6 #define V8_BASE_COMPILER_SPECIFIC_H_ 6 #define V8_BASE_COMPILER_SPECIFIC_H_
7 7
8 #include "include/v8config.h" 8 #include "include/v8config.h"
9 9
10 // Annotate a typedef or function indicating it's ok if it's not used. 10 // Annotate a typedef or function indicating it's ok if it's not used.
11 // Use like: 11 // Use like:
12 // typedef Foo Bar ALLOW_UNUSED_TYPE; 12 // typedef Foo Bar ALLOW_UNUSED_TYPE;
13 #if V8_HAS_ATTRIBUTE_UNUSED 13 #if V8_HAS_ATTRIBUTE_UNUSED
14 #define ALLOW_UNUSED_TYPE __attribute__((unused)) 14 #define ALLOW_UNUSED_TYPE __attribute__((unused))
15 #else 15 #else
16 #define ALLOW_UNUSED_TYPE 16 #define ALLOW_UNUSED_TYPE
17 #endif 17 #endif
18 18
19 19
20 // Annotate a function indicating the caller must examine the return value. 20 // Annotate a function indicating the caller must examine the return value.
21 // Use like: 21 // Use like:
22 // int foo() WARN_UNUSED_RESULT; 22 // int foo() WARN_UNUSED_RESULT;
23 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT 23 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
24 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 24 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
25 #else 25 #else
26 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */ 26 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */
27 #endif 27 #endif
28 28
29 // Tell the compiler a function is using a printf-style format string.
30 // |format_param| is the one-based index of the format string parameter;
31 // |dots_param| is the one-based index of the "..." parameter.
32 // For v*printf functions (which take a va_list), pass 0 for dots_param.
33 // (This is undocumented but matches what the system C headers do.)
34 #if defined(__GNUC__)
35 #define PRINTF_FORMAT(format_param, dots_param) \
36 __attribute__((format(printf, format_param, dots_param)))
37 #else
38 #define PRINTF_FORMAT(format_param, dots_param)
39 #endif
40 29
41 // The C++ standard requires that static const members have an out-of-class 30 // The C++ standard requires that static const members have an out-of-class
42 // definition (in a single compilation unit), but MSVC chokes on this (when 31 // definition (in a single compilation unit), but MSVC chokes on this (when
43 // language extensions, which are required, are enabled). (You're only likely to 32 // language extensions, which are required, are enabled). (You're only likely to
44 // notice the need for a definition if you take the address of the member or, 33 // notice the need for a definition if you take the address of the member or,
45 // more commonly, pass it to a function that takes it as a reference argument -- 34 // more commonly, pass it to a function that takes it as a reference argument --
46 // probably an STL function.) This macro makes MSVC do the right thing. See 35 // probably an STL function.) This macro makes MSVC do the right thing. See
47 // http://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx for more 36 // http://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx for more
48 // information. Use like: 37 // information. Use like:
49 // 38 //
50 // In .h file: 39 // In .h file:
51 // struct Foo { 40 // struct Foo {
52 // static const int kBar = 5; 41 // static const int kBar = 5;
53 // }; 42 // };
54 // 43 //
55 // In .cc file: 44 // In .cc file:
56 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar; 45 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar;
57 #if V8_HAS_DECLSPEC_SELECTANY 46 #if V8_HAS_DECLSPEC_SELECTANY
58 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) 47 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany)
59 #else 48 #else
60 #define STATIC_CONST_MEMBER_DEFINITION 49 #define STATIC_CONST_MEMBER_DEFINITION
61 #endif 50 #endif
62 51
63 #endif // V8_BASE_COMPILER_SPECIFIC_H_ 52 #endif // V8_BASE_COMPILER_SPECIFIC_H_
OLDNEW
« no previous file with comments | « src/ast/prettyprinter.cc ('k') | src/base/format-macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698