Skip to content

Commit

Permalink
Move stringize_macros to base/strings.
Browse files Browse the repository at this point in the history
This removes the unused L-string macros in the file.

BUG=

Review URL: https://codereview.chromium.org/12090083

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179926 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Jan 31, 2013
1 parent 61c5554 commit 8edbebd
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 72 deletions.
2 changes: 1 addition & 1 deletion base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,8 @@
'string_split_unittest.cc',
'string_tokenizer_unittest.cc',
'string_util_unittest.cc',
'stringize_macros_unittest.cc',
'stringprintf_unittest.cc',
'strings/stringize_macros_unittest.cc',
'synchronization/cancellation_flag_unittest.cc',
'synchronization/condition_variable_unittest.cc',
'synchronization/lock_unittest.cc',
Expand Down
2 changes: 1 addition & 1 deletion base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@
'string_util_win.h',
'string16.cc',
'string16.h',
'stringize_macros.h',
'stringprintf.cc',
'stringprintf.h',
'strings/stringize_macros.h',
'supports_user_data.cc',
'supports_user_data.h',
'synchronization/cancellation_flag.cc',
Expand Down
31 changes: 3 additions & 28 deletions base/stringize_macros.h → base/strings/stringize_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// symbols (or their output) and manipulating preprocessor symbols
// that define strings.

#ifndef BASE_STRINGIZE_MACROS_H_
#define BASE_STRINGIZE_MACROS_H_
#ifndef BASE_STRINGS_STRINGIZE_MACROS_H_
#define BASE_STRINGS_STRINGIZE_MACROS_H_

#include "build/build_config.h"

Expand All @@ -28,29 +28,4 @@
// STRINGIZE(B(y)) produces "myobj->FunctionCall(y)"
#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)

// The following are defined only on Windows (for use when interacting
// with Windows APIs) as wide strings are otherwise deprecated.
#if defined(OS_WIN)

// Second-level utility macros to let us expand symbols.
#define LSTRINGIZE_NO_EXPANSION(x) L ## #x
#define TO_L_STRING_NO_EXPANSION(x) L ## x

// L version of STRINGIZE(). For examples above,
// LSTRINGIZE(A) produces L"FOO"
// LSTRINGIZE(B(y)) produces L"myobj->FunctionCall(y)"
#define LSTRINGIZE(x) LSTRINGIZE_NO_EXPANSION(x)

// Adds an L in front of an existing ASCII string constant (after
// expanding symbols). Does not do any quoting.
//
// For example, if:
// #define C "foo"
//
// Then:
// TO_L_STRING(C) produces L"foo"
#define TO_L_STRING(x) TO_L_STRING_NO_EXPANSION(x)

#endif // defined(OS_WIN)

#endif // BASE_STRINGIZE_MACROS_H_
#endif // BASE_STRINGS_STRINGIZE_MACROS_H_
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Unit tests for stringize_macros.h

#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"

#include "testing/gtest/include/gtest/gtest.h"

Expand All @@ -29,31 +27,3 @@ TEST(StringizeTest, Ansi) {
STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_B(y)));
EXPECT_STREQ("\"foo\"", STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_C));
}

#if defined(OS_WIN)

TEST(StringizeTest, Wide) {
EXPECT_STREQ(
L"PREPROCESSOR_UTIL_UNITTEST_A",
LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_A));
EXPECT_STREQ(
L"PREPROCESSOR_UTIL_UNITTEST_B(y)",
LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_B(y)));
EXPECT_STREQ(
L"PREPROCESSOR_UTIL_UNITTEST_C",
LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_C));

EXPECT_STREQ(L"FOO", LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_A));
EXPECT_STREQ(L"myobj->FunctionCall(y)",
LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_B(y)));
EXPECT_STREQ(L"\"foo\"", LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_C));
}

TEST(ToLStringTest, Main) {
EXPECT_STREQ(L"blat", TO_L_STRING_NO_EXPANSION("blat"));

EXPECT_STREQ(L"foo", TO_L_STRING(PREPROCESSOR_UTIL_UNITTEST_C));
EXPECT_STREQ(L"blat", TO_L_STRING("blat"));
}

#endif // defined(OS_WIN)
2 changes: 1 addition & 1 deletion content/common/gpu/media/rendering_helper_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "base/bind.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "base/synchronization/waitable_event.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
Expand Down
2 changes: 1 addition & 1 deletion google_apis/google_api_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"

#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#include "google_apis/internal/google_chrome_api_keys.h"
Expand Down
2 changes: 1 addition & 1 deletion google_apis/google_api_keys_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"

// This is the default baked-in value for OAuth IDs and secrets.
static const char kDummyToken[] = "dummytoken";
Expand Down
2 changes: 1 addition & 1 deletion media/base/media_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "media/ffmpeg/ffmpeg_common.h"

#if !defined(USE_SYSTEM_FFMPEG)
Expand Down
2 changes: 1 addition & 1 deletion media/base/sinc_resampler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "base/time.h"
#include "build/build_config.h"
#include "media/base/sinc_resampler.h"
Expand Down
2 changes: 1 addition & 1 deletion net/base/net_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "base/basictypes.h"
#include "base/metrics/histogram.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"

namespace {

Expand Down
2 changes: 1 addition & 1 deletion remoting/host/plugin/host_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/at_exit.h"
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "net/socket/ssl_server_socket.h"
#include "remoting/base/plugin_thread_task_runner.h"
#include "remoting/host/plugin/constants.h"
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/remoting_me2me_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "base/single_thread_task_runner.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/server_log_entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "remoting/host/server_log_entry.h"

#include "base/logging.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "base/sys_info.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/session.h"
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/server_log_entry_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.

#include "base/memory/scoped_ptr.h"
#include "base/stringize_macros.h"
#include "base/strings/stringize_macros.h"
#include "remoting/host/server_log_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
Expand Down

0 comments on commit 8edbebd

Please sign in to comment.