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

Side by Side Diff: base/logging.h

Issue 613273005: Enable "extern template" under MSVC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | base/logging.cc » ('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 Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_LOGGING_H_ 5 #ifndef BASE_LOGGING_H_
6 #define BASE_LOGGING_H_ 6 #define BASE_LOGGING_H_
7 7
8 #include <cassert> 8 #include <cassert>
9 #include <string> 9 #include <string>
10 #include <cstring> 10 #include <cstring>
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // be out of line, while the "Impl" code should be inline. Caller 476 // be out of line, while the "Impl" code should be inline. Caller
477 // takes ownership of the returned string. 477 // takes ownership of the returned string.
478 template<class t1, class t2> 478 template<class t1, class t2>
479 std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { 479 std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) {
480 std::ostringstream ss; 480 std::ostringstream ss;
481 ss << names << " (" << v1 << " vs. " << v2 << ")"; 481 ss << names << " (" << v1 << " vs. " << v2 << ")";
482 std::string* msg = new std::string(ss.str()); 482 std::string* msg = new std::string(ss.str());
483 return msg; 483 return msg;
484 } 484 }
485 485
486 // MSVC doesn't like complex extern templates and DLLs.
487 #if !defined(COMPILER_MSVC)
488 // Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated 486 // Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
489 // in logging.cc. 487 // in logging.cc.
490 extern template BASE_EXPORT std::string* MakeCheckOpString<int, int>( 488 extern template BASE_EXPORT std::string* MakeCheckOpString<int, int>(
491 const int&, const int&, const char* names); 489 const int&, const int&, const char* names);
492 extern template BASE_EXPORT 490 extern template BASE_EXPORT
493 std::string* MakeCheckOpString<unsigned long, unsigned long>( 491 std::string* MakeCheckOpString<unsigned long, unsigned long>(
494 const unsigned long&, const unsigned long&, const char* names); 492 const unsigned long&, const unsigned long&, const char* names);
495 extern template BASE_EXPORT 493 extern template BASE_EXPORT
496 std::string* MakeCheckOpString<unsigned long, unsigned int>( 494 std::string* MakeCheckOpString<unsigned long, unsigned int>(
497 const unsigned long&, const unsigned int&, const char* names); 495 const unsigned long&, const unsigned int&, const char* names);
498 extern template BASE_EXPORT 496 extern template BASE_EXPORT
499 std::string* MakeCheckOpString<unsigned int, unsigned long>( 497 std::string* MakeCheckOpString<unsigned int, unsigned long>(
500 const unsigned int&, const unsigned long&, const char* names); 498 const unsigned int&, const unsigned long&, const char* names);
501 extern template BASE_EXPORT 499 extern template BASE_EXPORT
502 std::string* MakeCheckOpString<std::string, std::string>( 500 std::string* MakeCheckOpString<std::string, std::string>(
503 const std::string&, const std::string&, const char* name); 501 const std::string&, const std::string&, const char* name);
504 #endif
505 502
506 // Helper functions for CHECK_OP macro. 503 // Helper functions for CHECK_OP macro.
507 // The (int, int) specialization works around the issue that the compiler 504 // The (int, int) specialization works around the issue that the compiler
508 // will not instantiate the template version of the function on values of 505 // will not instantiate the template version of the function on values of
509 // unnamed enum type - see comment below. 506 // unnamed enum type - see comment below.
510 #define DEFINE_CHECK_OP_IMPL(name, op) \ 507 #define DEFINE_CHECK_OP_IMPL(name, op) \
511 template <class t1, class t2> \ 508 template <class t1, class t2> \
512 inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ 509 inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \
513 const char* names) { \ 510 const char* names) { \
514 if (v1 op v2) return NULL; \ 511 if (v1 op v2) return NULL; \
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 #elif NOTIMPLEMENTED_POLICY == 5 887 #elif NOTIMPLEMENTED_POLICY == 5
891 #define NOTIMPLEMENTED() do {\ 888 #define NOTIMPLEMENTED() do {\
892 static bool logged_once = false;\ 889 static bool logged_once = false;\
893 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 890 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
894 logged_once = true;\ 891 logged_once = true;\
895 } while(0);\ 892 } while(0);\
896 EAT_STREAM_PARAMETERS 893 EAT_STREAM_PARAMETERS
897 #endif 894 #endif
898 895
899 #endif // BASE_LOGGING_H_ 896 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698