diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 19:10:03 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 19:10:03 +0000 |
commit | 6d445d3505284cc5d0310c46a68f096845fcd848 (patch) | |
tree | ba3d2233e9ce122ec0452311aee426469d7acb87 | |
parent | 15baed1691e3d6c5c129a95efac961fc24474df6 (diff) | |
download | chromium_src-6d445d3505284cc5d0310c46a68f096845fcd848.zip chromium_src-6d445d3505284cc5d0310c46a68f096845fcd848.tar.gz chromium_src-6d445d3505284cc5d0310c46a68f096845fcd848.tar.bz2 |
Mark the most common uses of MakeCheckOpString as extern templates on gcc platforms.
Remove broken template specializations that were never instantiated that
references extern code that doesn't exist in the project (!).
BUG=none
TEST=compiles, smaller binaries on linux, chromeos and mac
Review URL: http://codereview.chromium.org/3594003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61092 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/logging.cc | 14 | ||||
-rw-r--r-- | base/logging.h | 23 |
2 files changed, 29 insertions, 8 deletions
diff --git a/base/logging.cc b/base/logging.cc index ef1a746..f0c6217 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -409,6 +409,20 @@ void SetLogMessageHandler(LogMessageHandlerFunction handler) { log_message_handler = handler; } +// MSVC doesn't like complex extern templates and DLLs. +#if !defined(COMPILER_MSVC) +// Explicit instantiations for commonly used comparisons. +template std::string* MakeCheckOpString<int, int>( + const int&, const int&, const char* names); +template std::string* MakeCheckOpString<unsigned long, unsigned long>( + const unsigned long&, const unsigned long&, const char* names); +template std::string* MakeCheckOpString<unsigned long, unsigned int>( + const unsigned long&, const unsigned int&, const char* names); +template std::string* MakeCheckOpString<unsigned int, unsigned long>( + const unsigned int&, const unsigned long&, const char* names); +template std::string* MakeCheckOpString<std::string, std::string>( + const std::string&, const std::string&, const char* name); +#endif // Displays a message box to the user with the error message in it. // Used for fatal messages, where we close the app simultaneously. diff --git a/base/logging.h b/base/logging.h index 0864ac6..928d772 100644 --- a/base/logging.h +++ b/base/logging.h @@ -395,14 +395,21 @@ std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { return msg; } -extern std::string* MakeCheckOpStringIntInt(int v1, int v2, const char* names); - -template<int, int> -std::string* MakeCheckOpString(const int& v1, - const int& v2, - const char* names) { - return MakeCheckOpStringIntInt(v1, v2, names); -} +// MSVC doesn't like complex extern templates and DLLs. +#if !defined(COMPILER_MSVC) +// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated +// in logging.cc. +extern template std::string* MakeCheckOpString<int, int>( + const int&, const int&, const char* names); +extern template std::string* MakeCheckOpString<unsigned long, unsigned long>( + const unsigned long&, const unsigned long&, const char* names); +extern template std::string* MakeCheckOpString<unsigned long, unsigned int>( + const unsigned long&, const unsigned int&, const char* names); +extern template std::string* MakeCheckOpString<unsigned int, unsigned long>( + const unsigned int&, const unsigned long&, const char* names); +extern template std::string* MakeCheckOpString<std::string, std::string>( + const std::string&, const std::string&, const char* name); +#endif // Helper macro for binary operators. // Don't use this macro directly in your code, use CHECK_EQ et al below. |