Commit b9c53d8d by Yuly Novikov Committed by Commit Bot

Remove FormatString

And the global static it uses. BUG=angleproject:1644 Change-Id: I6c8b186ef0dce83fe64620729af4d87ea81c77f5 Reviewed-on: https://chromium-review.googlesource.com/577922Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 0d2ecb4e
......@@ -42,20 +42,3 @@ size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>
ASSERT(len >= 0);
return static_cast<size_t>(len);
}
std::string FormatString(const char *fmt, va_list vararg)
{
static std::vector<char> buffer(512);
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
return std::string(&buffer[0], len);
}
std::string FormatString(const char *fmt, ...)
{
va_list vararg;
va_start(vararg, fmt);
std::string result = FormatString(fmt, vararg);
va_end(vararg);
return result;
}
......@@ -6,6 +6,8 @@
#include "libANGLE/renderer/d3d/HLSLCompiler.h"
#include <sstream>
#include "common/utilities.h"
#include "libANGLE/Program.h"
#include "libANGLE/features.h"
......@@ -190,7 +192,9 @@ gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &infoLog, const std::string
if (gl::DebugAnnotationsActive())
{
std::string sourcePath = getTempPath();
std::string sourceText = FormatString("#line 2 \"%s\"\n\n%s", sourcePath.c_str(), hlsl.c_str());
std::ostringstream stream;
stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;
std::string sourceText = stream.str();
writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
}
#endif
......
......@@ -104,7 +104,10 @@ egl::Error DisplayWGL::initialize(egl::Display *display)
// Work around compile error from not defining "UNICODE" while Chromium does
const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
std::string className = FormatString("ANGLE DisplayWGL 0x%0.8p Intermediate Window Class", mDisplay);
std::ostringstream stream;
stream << "ANGLE DisplayWGL " << std::internal << std::setw(10) << std::setfill('0') << mDisplay
<< " Intermediate Window Class";
std::string className = stream.str();
WNDCLASSA intermediateClassDesc = { 0 };
intermediateClassDesc.style = CS_OWNDC;
......
diff -u -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectations/angle_config.h
diff -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectations/angle_config.h
--- gpu_test_expectations_reverted/angle_config.h 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/angle_config.h 2016-08-24 13:18:58.877015665 -0400
@@ -0,0 +1,66 @@
+++ gpu_test_expectations/angle_config.h 2017-07-19 18:08:09.552231453 -0400
@@ -0,0 +1,61 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
......@@ -45,11 +45,6 @@ diff -u -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectation
+ using angle::SplitStringAlongWhitespace;
+ using angle::HexStringToUInt;
+ using angle::ReadFileToString;
+
+ // StringPrintf is called differently in ANGLE but using cannot change
+ // the name of the imported function. Use a define to change the name.
+ using ::FormatString;
+ #define StringPrintf FormatString
+}
+
+// TODO(jmadill): other platforms
......@@ -68,9 +63,9 @@ diff -u -rupN gpu_test_expectations_reverted/angle_config.h gpu_test_expectation
+// clang-format on
+
+#endif
diff -u -rupN gpu_test_expectations_reverted/gpu_info.cc gpu_test_expectations/gpu_info.cc
--- gpu_test_expectations_reverted/gpu_info.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_info.cc 2015-11-25 15:47:24.575592261 -0500
diff -rupN gpu_test_expectations_reverted/gpu_info.cc gpu_test_expectations/gpu_info.cc
--- gpu_test_expectations_reverted/gpu_info.cc 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_info.cc 2017-05-19 17:51:38.665944833 -0400
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -180,9 +175,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_info.cc gpu_test_expectations/g
enumerator->AddBool("jpegDecodeAcceleratorSupported",
jpeg_decode_accelerator_supported);
enumerator->EndAuxAttributes();
diff -u -rupN gpu_test_expectations_reverted/gpu_info.h gpu_test_expectations/gpu_info.h
--- gpu_test_expectations_reverted/gpu_info.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_info.h 2015-11-25 15:47:24.575592261 -0500
diff -rupN gpu_test_expectations_reverted/gpu_info.h gpu_test_expectations/gpu_info.h
--- gpu_test_expectations_reverted/gpu_info.h 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_info.h 2017-05-19 17:51:38.665944833 -0400
@@ -11,13 +11,7 @@
#include <string>
#include <vector>
......@@ -273,9 +268,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_info.h gpu_test_expectations/gp
// Markers indicating that a GPUDevice is being described.
virtual void BeginGPUDevice() = 0;
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.cc gpu_test_expectations/gpu_test_config.cc
--- gpu_test_expectations_reverted/gpu_test_config.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_config.cc 2016-09-14 14:55:40.134685526 -0400
diff -rupN gpu_test_expectations_reverted/gpu_test_config.cc gpu_test_expectations/gpu_test_config.cc
--- gpu_test_expectations_reverted/gpu_test_config.cc 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_test_config.cc 2017-05-19 18:24:51.028549550 -0400
@@ -2,20 +2,205 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -578,9 +573,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.cc gpu_test_expecta
-
} // namespace gpu
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.h gpu_test_expectations/gpu_test_config.h
--- gpu_test_expectations_reverted/gpu_test_config.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_config.h 2015-11-25 15:47:24.575592261 -0500
diff -rupN gpu_test_expectations_reverted/gpu_test_config.h gpu_test_expectations/gpu_test_config.h
--- gpu_test_expectations_reverted/gpu_test_config.h 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_test_config.h 2017-05-19 17:51:38.665944833 -0400
@@ -8,9 +8,7 @@
#include <string>
#include <vector>
......@@ -602,9 +597,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_config.h gpu_test_expectat
};
} // namespace gpu
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.h gpu_test_expectations/gpu_test_config_mac.h
diff -rupN gpu_test_expectations_reverted/gpu_test_config_mac.h gpu_test_expectations/gpu_test_config_mac.h
--- gpu_test_expectations_reverted/gpu_test_config_mac.h 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/gpu_test_config_mac.h 2015-09-16 16:05:45.788950024 -0400
+++ gpu_test_expectations/gpu_test_config_mac.h 2017-05-19 17:51:38.665944833 -0400
@@ -0,0 +1,28 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
......@@ -634,9 +629,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.h gpu_test_expe
+gpu::GPUInfo::GPUDevice GetActiveGPU();
+
+#endif // GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.mm gpu_test_expectations/gpu_test_config_mac.mm
diff -rupN gpu_test_expectations_reverted/gpu_test_config_mac.mm gpu_test_expectations/gpu_test_config_mac.mm
--- gpu_test_expectations_reverted/gpu_test_config_mac.mm 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/gpu_test_config_mac.mm 2017-02-13 11:20:54.656424702 -0500
+++ gpu_test_expectations/gpu_test_config_mac.mm 2017-05-19 18:24:51.028549550 -0400
@@ -0,0 +1,75 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
......@@ -713,10 +708,10 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_config_mac.mm gpu_test_exp
+ return gpu;
+}
+
diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu_test_expectations/gpu_test_expectations_parser.cc
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.cc 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_expectations_parser.cc 2015-11-25 15:47:24.575592261 -0500
@@ -2,14 +2,43 @@
diff -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu_test_expectations/gpu_test_expectations_parser.cc
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.cc 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_test_expectations_parser.cc 2017-07-19 18:56:42.954781389 -0400
@@ -2,14 +2,45 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -729,6 +724,8 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
+#include <sstream>
+
+#include "common/angleutils.h"
+
+namespace base {
......@@ -767,7 +764,7 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
namespace gpu {
@@ -146,9 +175,9 @@ const char* kErrorMessage[] = {
@@ -146,9 +177,9 @@ const char* kErrorMessage[] = {
};
Token ParseToken(const std::string& word) {
......@@ -779,7 +776,7 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
return kConfigGPUDeviceID;
for (int32 i = 0; i < kNumberOfExactMatchTokens; ++i) {
@@ -176,10 +205,10 @@ bool NamesMatching(const std::string& re
@@ -176,10 +207,10 @@ bool NamesMatching(const std::string& re
GPUTestExpectationsParser::GPUTestExpectationsParser() {
// Some sanity check.
......@@ -794,7 +791,7 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
}
GPUTestExpectationsParser::~GPUTestExpectationsParser() {
@@ -204,8 +233,8 @@ bool GPUTestExpectationsParser::LoadTest
@@ -204,8 +235,8 @@ bool GPUTestExpectationsParser::LoadTest
return rt;
}
......@@ -805,7 +802,7 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
entries_.clear();
error_messages_.clear();
@@ -399,7 +428,7 @@ bool GPUTestExpectationsParser::ParseLin
@@ -399,7 +430,7 @@ bool GPUTestExpectationsParser::ParseLin
stage++;
break;
default:
......@@ -814,7 +811,7 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
break;
}
}
@@ -488,7 +517,7 @@ bool GPUTestExpectationsParser::UpdateTe
@@ -488,7 +519,7 @@ bool GPUTestExpectationsParser::UpdateTe
config->set_api(config->api() | kTokenData[token].flag);
break;
default:
......@@ -823,9 +820,36 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.cc gpu
break;
}
return true;
diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.h gpu_test_expectations/gpu_test_expectations_parser.h
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.h 2017-02-13 11:15:30.922221193 -0500
+++ gpu_test_expectations/gpu_test_expectations_parser.h 2015-06-30 09:40:06.654788989 -0400
@@ -529,20 +560,18 @@ bool GPUTestExpectationsParser::DetectCo
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, size_t line_number) {
- error_messages_.push_back(
- base::StringPrintf("Line %d : %s",
- static_cast<int>(line_number), message.c_str()));
+ std::ostringstream stream;
+ stream << "Line " << line_number << " : " << message;
+ error_messages_.push_back(stream.str());
}
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message,
size_t entry1_line_number,
size_t entry2_line_number) {
- error_messages_.push_back(
- base::StringPrintf("Line %d and %d : %s",
- static_cast<int>(entry1_line_number),
- static_cast<int>(entry2_line_number),
- message.c_str()));
+ std::ostringstream stream;
+ stream << "Line " << entry1_line_number << " and " << entry2_line_number << " : " << message;
+ error_messages_.push_back(stream.str());
}
GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry()
diff -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.h gpu_test_expectations/gpu_test_expectations_parser.h
--- gpu_test_expectations_reverted/gpu_test_expectations_parser.h 2017-07-19 18:00:16.369751203 -0400
+++ gpu_test_expectations/gpu_test_expectations_parser.h 2017-05-19 17:51:38.665944833 -0400
@@ -8,10 +8,8 @@
#include <string>
#include <vector>
......@@ -848,9 +872,9 @@ diff -u -rupN gpu_test_expectations_reverted/gpu_test_expectations_parser.h gpu_
// Query error messages from the last LoadTestExpectations() call.
const std::vector<std::string>& GetErrorMessages() const;
diff -u -rupN gpu_test_expectations_reverted/HowToMakeChanges.md gpu_test_expectations/HowToMakeChanges.md
diff -rupN gpu_test_expectations_reverted/HowToMakeChanges.md gpu_test_expectations/HowToMakeChanges.md
--- gpu_test_expectations_reverted/HowToMakeChanges.md 1969-12-31 19:00:00.000000000 -0500
+++ gpu_test_expectations/HowToMakeChanges.md 2016-09-14 14:55:40.134685526 -0400
+++ gpu_test_expectations/HowToMakeChanges.md 2017-05-19 18:24:51.024549569 -0400
@@ -0,0 +1,22 @@
+Because the ```gpu_test_expectations``` directory is based on parts of Chromium's ```gpu/config```
+directory, we want to keep a patch of the changes added to make it compile with ANGLE. This
......
......@@ -41,11 +41,6 @@ namespace base
using angle::SplitStringAlongWhitespace;
using angle::HexStringToUInt;
using angle::ReadFileToString;
// StringPrintf is called differently in ANGLE but using cannot change
// the name of the imported function. Use a define to change the name.
using ::FormatString;
#define StringPrintf FormatString
}
// TODO(jmadill): other platforms
......
......@@ -4,6 +4,8 @@
#include "gpu_test_expectations_parser.h"
#include <sstream>
#include "common/angleutils.h"
namespace base {
......@@ -558,20 +560,18 @@ bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() {
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, size_t line_number) {
error_messages_.push_back(
base::StringPrintf("Line %d : %s",
static_cast<int>(line_number), message.c_str()));
std::ostringstream stream;
stream << "Line " << line_number << " : " << message;
error_messages_.push_back(stream.str());
}
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message,
size_t entry1_line_number,
size_t entry2_line_number) {
error_messages_.push_back(
base::StringPrintf("Line %d and %d : %s",
static_cast<int>(entry1_line_number),
static_cast<int>(entry2_line_number),
message.c_str()));
std::ostringstream stream;
stream << "Line " << entry1_line_number << " and " << entry2_line_number << " : " << message;
error_messages_.push_back(stream.str());
}
GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment