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

Side by Side Diff: tools/flags/SkCommandLineFlags.h

Issue 1170863006: Label some unused static vars as SK_UNUSED (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « include/images/SkForceLinking.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SK_COMMAND_LINE_FLAGS_H 8 #ifndef SK_COMMAND_LINE_FLAGS_H
9 #define SK_COMMAND_LINE_FLAGS_H 9 #define SK_COMMAND_LINE_FLAGS_H
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 // For access to gHead. 174 // For access to gHead.
175 friend class SkFlagInfo; 175 friend class SkFlagInfo;
176 }; 176 };
177 177
178 #define TO_STRING2(s) #s 178 #define TO_STRING2(s) #s
179 #define TO_STRING(s) TO_STRING2(s) 179 #define TO_STRING(s) TO_STRING2(s)
180 180
181 #define DEFINE_bool(name, defaultValue, helpString) \ 181 #define DEFINE_bool(name, defaultValue, helpString) \
182 bool FLAGS_##name; \ 182 bool FLAGS_##name; \
183 static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \ 183 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name) , \
184 NULL, \ 184 NULL, \
185 &FLAGS_##name, \ 185 &FLAGS_##name, \
186 defaultValue, \ 186 defaultValue, \
187 helpString) 187 helpString)
188 188
189 // bool 2 allows specifying a short name. No check is done to ensure that shortN ame 189 // bool 2 allows specifying a short name. No check is done to ensure that shortN ame
190 // is actually shorter than name. 190 // is actually shorter than name.
191 #define DEFINE_bool2(name, shortName, defaultValue, helpString) \ 191 #define DEFINE_bool2(name, shortName, defaultValue, helpString) \
192 bool FLAGS_##name; \ 192 bool FLAGS_##name; \
193 static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \ 193 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name) , \
194 TO_STRING(shortName),\ 194 TO_STRING(short Name),\
195 &FLAGS_##name, \ 195 &FLAGS_##name, \
196 defaultValue, \ 196 defaultValue, \
197 helpString) 197 helpString)
198 198
199 #define DECLARE_bool(name) extern bool FLAGS_##name; 199 #define DECLARE_bool(name) extern bool FLAGS_##name;
200 200
201 #define DEFINE_string(name, defaultValue, helpString) \ 201 #define DEFINE_string(name, defaultValue, helpString) \
202 SkCommandLineFlags::StringArray FLAGS_##name; \ 202 SkCommandLineFlags::StringArray FLAGS_##name; \
203 static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \ 203 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam e), \
204 NULL, \ 204 NULL, \
205 &FLAGS_##name, \ 205 &FLAGS_##name , \
206 defaultValue, \ 206 defaultValue, \
207 helpString) 207 helpString)
208 208
209 // string2 allows specifying a short name. There is an assert that shortName 209 // string2 allows specifying a short name. There is an assert that shortName
210 // is only 1 character. 210 // is only 1 character.
211 #define DEFINE_string2(name, shortName, defaultValue, helpString) \ 211 #define DEFINE_string2(name, shortName, defaultValue, helpString) \
212 SkCommandLineFlags::StringArray FLAGS_##name; \ 212 SkCommandLineFlags::StringArray FLAGS_##name; \
213 static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \ 213 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam e), \
214 TO_STRING(shortName), \ 214 TO_STRING(sho rtName), \
215 &FLAGS_##name, \ 215 &FLAGS_##name , \
216 defaultValue, \ 216 defaultValue, \
217 helpString) 217 helpString)
218 218
219 #define DECLARE_string(name) extern SkCommandLineFlags::StringArray FLAGS_##name ; 219 #define DECLARE_string(name) extern SkCommandLineFlags::StringArray FLAGS_##name ;
220 220
221 #define DEFINE_int32(name, defaultValue, helpString) \ 221 #define DEFINE_int32(name, defaultValue, helpString) \
222 int32_t FLAGS_##name; \ 222 int32_t FLAGS_##name; \
223 static bool unused_##name = SkFlagInfo::CreateIntFlag(TO_STRING(name), \ 223 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateIntFlag(TO_STRING(name), \
224 &FLAGS_##name, \ 224 &FLAGS_##name, \
225 defaultValue, \ 225 defaultValue, \
226 helpString) 226 helpString)
227 227
228 #define DECLARE_int32(name) extern int32_t FLAGS_##name; 228 #define DECLARE_int32(name) extern int32_t FLAGS_##name;
229 229
230 #define DEFINE_double(name, defaultValue, helpString) \ 230 #define DEFINE_double(name, defaultValue, helpString) \
231 double FLAGS_##name; \ 231 double FLAGS_##name; \
232 static bool unused_##name = SkFlagInfo::CreateDoubleFlag(TO_STRING(name), \ 232 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateDoubleFlag(TO_STRING(nam e), \
233 &FLAGS_##name, \ 233 &FLAGS_##name , \
234 defaultValue, \ 234 defaultValue, \
235 helpString) 235 helpString)
236 236
237 #define DECLARE_double(name) extern double FLAGS_##name; 237 #define DECLARE_double(name) extern double FLAGS_##name;
238 238
239 class SkFlagInfo { 239 class SkFlagInfo {
240 240
241 public: 241 public:
242 enum FlagTypes { 242 enum FlagTypes {
243 kBool_FlagType, 243 kBool_FlagType,
244 kString_FlagType, 244 kString_FlagType,
245 kInt_FlagType, 245 kInt_FlagType,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 double* fDoubleValue; 441 double* fDoubleValue;
442 double fDefaultDouble; 442 double fDefaultDouble;
443 SkCommandLineFlags::StringArray* fStrings; 443 SkCommandLineFlags::StringArray* fStrings;
444 // Both for the help string and in case fStrings is empty. 444 // Both for the help string and in case fStrings is empty.
445 SkString fDefaultString; 445 SkString fDefaultString;
446 446
447 // In order to keep a linked list. 447 // In order to keep a linked list.
448 SkFlagInfo* fNext; 448 SkFlagInfo* fNext;
449 }; 449 };
450 #endif // SK_COMMAND_LINE_FLAGS_H 450 #endif // SK_COMMAND_LINE_FLAGS_H
OLDNEW
« no previous file with comments | « include/images/SkForceLinking.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698