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

Side by Side Diff: runtime/platform/assert.h

Issue 10869063: Add attributions so printf like functions can have their arguments checked. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/platform/globals.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef PLATFORM_ASSERT_H_ 5 #ifndef PLATFORM_ASSERT_H_
6 #define PLATFORM_ASSERT_H_ 6 #define PLATFORM_ASSERT_H_
7 7
8 // TODO(5411406): include sstream for now, once we have a Utils::toString() 8 // TODO(5411406): include sstream for now, once we have a Utils::toString()
9 // implemented for all the primitive types we can replace the usage of 9 // implemented for all the primitive types we can replace the usage of
10 // sstream by Utils::toString() 10 // sstream by Utils::toString()
(...skipping 15 matching lines...) Expand all
26 class DynamicAssertionHelper { 26 class DynamicAssertionHelper {
27 public: 27 public:
28 enum Kind { 28 enum Kind {
29 ASSERT, 29 ASSERT,
30 EXPECT 30 EXPECT
31 }; 31 };
32 32
33 DynamicAssertionHelper(const char* file, int line, Kind kind) 33 DynamicAssertionHelper(const char* file, int line, Kind kind)
34 : file_(file), line_(line), kind_(kind) { } 34 : file_(file), line_(line), kind_(kind) { }
35 35
36 void Fail(const char* format, ...); 36 void Fail(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
37 37
38 #if defined(TESTING) 38 #if defined(TESTING)
39 template<typename E, typename A> 39 template<typename E, typename A>
40 void Equals(const E& expected, const A& actual); 40 void Equals(const E& expected, const A& actual);
41 41
42 template<typename E, typename A> 42 template<typename E, typename A>
43 void NotEquals(const E& not_expected, const A& actual); 43 void NotEquals(const E& not_expected, const A& actual);
44 44
45 template<typename E, typename A, typename T> 45 template<typename E, typename A, typename T>
46 void FloatEquals(const E& expected, const A& actual, const T& tol); 46 void FloatEquals(const E& expected, const A& actual, const T& tol);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 #define WARN(error) \ 342 #define WARN(error) \
343 dart::Expect(__FILE__, __LINE__).Fail("%s", error) 343 dart::Expect(__FILE__, __LINE__).Fail("%s", error)
344 344
345 #define WARN1(format, p1) \ 345 #define WARN1(format, p1) \
346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1)) 346 dart::Expect(__FILE__, __LINE__).Fail(format, (p1))
347 347
348 #define WARN2(format, p1, p2) \ 348 #define WARN2(format, p1, p2) \
349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2)) 349 dart::Expect(__FILE__, __LINE__).Fail(format, (p1), (p2))
350 350
351 #endif // PLATFORM_ASSERT_H_ 351 #endif // PLATFORM_ASSERT_H_
OLDNEW
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/platform/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698