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

Side by Side Diff: base/compiler_specific.h

Issue 339059: Add compiler-specific "examine printf format" attributes to printfs. (Closed)
Patch Set: cleanups Created 11 years, 1 month 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 | « no previous file | base/format_macros.h » ('j') | base/string_util_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium 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 BASE_COMPILER_SPECIFIC_H_ 5 #ifndef BASE_COMPILER_SPECIFIC_H_
6 #define BASE_COMPILER_SPECIFIC_H_ 6 #define BASE_COMPILER_SPECIFIC_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(COMPILER_MSVC) 10 #if defined(COMPILER_MSVC)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #define MSVC_PUSH_WARNING_LEVEL(n) 60 #define MSVC_PUSH_WARNING_LEVEL(n)
61 #define MSVC_POP_WARNING() 61 #define MSVC_POP_WARNING()
62 #define MSVC_DISABLE_OPTIMIZE() 62 #define MSVC_DISABLE_OPTIMIZE()
63 #define MSVC_ENABLE_OPTIMIZE() 63 #define MSVC_ENABLE_OPTIMIZE()
64 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code 64 #define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
65 65
66 #endif // COMPILER_MSVC 66 #endif // COMPILER_MSVC
67 67
68 68
69 #if defined(COMPILER_GCC) 69 #if defined(COMPILER_GCC)
70
70 #define ALLOW_UNUSED __attribute__((unused)) 71 #define ALLOW_UNUSED __attribute__((unused))
71 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 72 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
73
74 // Tell the compiler a function is using a printf-style format string.
75 // |format_param| is the one-based index of the format string parameter;
76 // |dots_param| is the one-based index of the "..." parameter.
77 // For v*printf functions (which take a va_list), pass 0 for dots_param.
78 // (This is undocumented but matches what the system C headers do.)
79 #define PRINTF_FORMAT(format_param, dots_param) \
80 __attribute__((format(printf, format_param, dots_param)))
81
82 // WPRINTF_FORMAT is the same, but for wide format strings.
83 // This doesn't appear to yet be implemented.
84 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38308 .
85 #define WPRINTF_FORMAT(format_param, dots_param)
86 // If available, it would look like:
87 // __attribute__((format(wprintf, format_param, dots_param)))
88
72 #else // Not GCC 89 #else // Not GCC
90
73 #define ALLOW_UNUSED 91 #define ALLOW_UNUSED
74 #define WARN_UNUSED_RESULT 92 #define WARN_UNUSED_RESULT
93 #define PRINTF_FORMAT(x, y)
94 #define WPRINTF_FORMAT(x, y)
95
75 #endif 96 #endif
76 97
77 #endif // BASE_COMPILER_SPECIFIC_H_ 98 #endif // BASE_COMPILER_SPECIFIC_H_
OLDNEW
« no previous file with comments | « no previous file | base/format_macros.h » ('j') | base/string_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698