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

Side by Side Diff: base/preprocessor_util.h

Issue 5103001: Add shared macros for stringizing and converting ANSI string constants... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gypi ('k') | base/preprocessor_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This file defines utility preprocessor macros.
6
7 #ifndef BASE_PREPROCESSOR_UTIL_H_
8 #define BASE_PREPROCESSOR_UTIL_H_
9 #pragma once
10
11 // These are not very useful; they do not expand defined symbols if
12 // called directly. Use their counterparts without the _NO_EXPANSION
13 // suffix, below.
14 #define STRINGIZE_NO_EXPANSION(x) #x
15 #define LSTRINGIZE_NO_EXPANSION(x) L ## #x
Evan Martin 2010/11/17 23:37:29 We have deprecated wide strings. If you really ne
16 #define TO_L_STRING_NO_EXPANSION(x) L ## x
17
18 // Use these to quote the provided parameter, first expanding it if it
19 // is a preprocessor symbol. The L version quotes it as a wide string,
20 // the non-L version as an ANSI string.
21 //
22 // For example, if:
23 // #define A FOO
24 // #define B(x) myobj->FunctionCall(x)
25 //
26 // Then:
27 // STRINGIZE(A) produces "FOO"
28 // LSTRINGIZE(B(y)) produces L"myobj->FunctionCall(y)"
29 #define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
30 #define LSTRINGIZE(x) LSTRINGIZE_NO_EXPANSION(x)
31
32 // Adds an L in front of an existing ANSI string constant (after
33 // expanding symbols). Does not do any quoting.
34 //
35 // For example, if:
36 // #define C "foo"
37 //
38 // Then:
39 // TO_L_STRING(C) produces L"foo"
40 #define TO_L_STRING(x) TO_L_STRING_NO_EXPANSION(x)
41
42 #endif // BASE_PREPROCESSOR_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/preprocessor_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698