Chromium Code Reviews| Index: base/preprocessor_util.h |
| =================================================================== |
| --- base/preprocessor_util.h (revision 0) |
| +++ base/preprocessor_util.h (revision 0) |
| @@ -0,0 +1,42 @@ |
| +// 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. |
| +// |
| +// This file defines utility preprocessor macros. |
| + |
| +#ifndef BASE_PREPROCESSOR_UTIL_H_ |
| +#define BASE_PREPROCESSOR_UTIL_H_ |
| +#pragma once |
| + |
| +// These are not very useful; they do not expand defined symbols if |
| +// called directly. Use their counterparts without the _NO_EXPANSION |
| +// suffix, below. |
| +#define STRINGIZE_NO_EXPANSION(x) #x |
| +#define LSTRINGIZE_NO_EXPANSION(x) L ## #x |
|
Evan Martin
2010/11/17 23:37:29
We have deprecated wide strings. If you really ne
|
| +#define TO_L_STRING_NO_EXPANSION(x) L ## x |
| + |
| +// Use these to quote the provided parameter, first expanding it if it |
| +// is a preprocessor symbol. The L version quotes it as a wide string, |
| +// the non-L version as an ANSI string. |
| +// |
| +// For example, if: |
| +// #define A FOO |
| +// #define B(x) myobj->FunctionCall(x) |
| +// |
| +// Then: |
| +// STRINGIZE(A) produces "FOO" |
| +// LSTRINGIZE(B(y)) produces L"myobj->FunctionCall(y)" |
| +#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x) |
| +#define LSTRINGIZE(x) LSTRINGIZE_NO_EXPANSION(x) |
| + |
| +// Adds an L in front of an existing ANSI 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 // BASE_PREPROCESSOR_UTIL_H_ |
| Property changes on: base\preprocessor_util.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |