stringize_macros.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. // Modified from the Chromium original:
  11. // src/base/strings/stringize_macros.h
  12. // This file defines preprocessor macros for stringizing preprocessor
  13. // symbols (or their output) and manipulating preprocessor symbols
  14. // that define strings.
  15. #ifndef RTC_BASE_STRINGIZE_MACROS_H_
  16. #define RTC_BASE_STRINGIZE_MACROS_H_
  17. // This is not very useful as it does not expand defined symbols if
  18. // called directly. Use its counterpart without the _NO_EXPANSION
  19. // suffix, below.
  20. #define STRINGIZE_NO_EXPANSION(x) #x
  21. // Use this to quote the provided parameter, first expanding it if it
  22. // is a preprocessor symbol.
  23. //
  24. // For example, if:
  25. // #define A FOO
  26. // #define B(x) myobj->FunctionCall(x)
  27. //
  28. // Then:
  29. // STRINGIZE(A) produces "FOO"
  30. // STRINGIZE(B(y)) produces "myobj->FunctionCall(y)"
  31. #define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
  32. #endif // RTC_BASE_STRINGIZE_MACROS_H_