16d528ed9Sopenharmony_ci// Copyright (c) 2010 The Chromium Authors. All rights reserved.
26d528ed9Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
36d528ed9Sopenharmony_ci// found in the LICENSE file.
46d528ed9Sopenharmony_ci//
56d528ed9Sopenharmony_ci// This file defines preprocessor macros for stringizing preprocessor
66d528ed9Sopenharmony_ci// symbols (or their output) and manipulating preprocessor symbols
76d528ed9Sopenharmony_ci// that define strings.
86d528ed9Sopenharmony_ci
96d528ed9Sopenharmony_ci#ifndef BASE_STRINGS_STRINGIZE_MACROS_H_
106d528ed9Sopenharmony_ci#define BASE_STRINGS_STRINGIZE_MACROS_H_
116d528ed9Sopenharmony_ci
126d528ed9Sopenharmony_ci#include "util/build_config.h"
136d528ed9Sopenharmony_ci
146d528ed9Sopenharmony_ci// This is not very useful as it does not expand defined symbols if
156d528ed9Sopenharmony_ci// called directly. Use its counterpart without the _NO_EXPANSION
166d528ed9Sopenharmony_ci// suffix, below.
176d528ed9Sopenharmony_ci#define STRINGIZE_NO_EXPANSION(x) #x
186d528ed9Sopenharmony_ci
196d528ed9Sopenharmony_ci// Use this to quote the provided parameter, first expanding it if it
206d528ed9Sopenharmony_ci// is a preprocessor symbol.
216d528ed9Sopenharmony_ci//
226d528ed9Sopenharmony_ci// For example, if:
236d528ed9Sopenharmony_ci//   #define A FOO
246d528ed9Sopenharmony_ci//   #define B(x) myobj->FunctionCall(x)
256d528ed9Sopenharmony_ci//
266d528ed9Sopenharmony_ci// Then:
276d528ed9Sopenharmony_ci//   STRINGIZE(A) produces "FOO"
286d528ed9Sopenharmony_ci//   STRINGIZE(B(y)) produces "myobj->FunctionCall(y)"
296d528ed9Sopenharmony_ci#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
306d528ed9Sopenharmony_ci
316d528ed9Sopenharmony_ci#endif  // BASE_STRINGS_STRINGIZE_MACROS_H_
32