From eccec8684142e05f2f92f0f5bd5b47dda3ba1529 Mon Sep 17 00:00:00 2001 From: JeanHeyd Meneide Date: Tue, 1 Dec 2020 14:39:47 -0700 Subject: Feature: Macros for identifying the wide and narrow execution string literal encoding gcc/c-family * c-cppbuiltin.c (c_cpp_builtins): Add predefined {__GNUC_EXECUTION_CHARSET_NAME} and _WIDE_EXECUTION_CHARSET_NAME} macros. gcc/ * doc/cpp.texi: Document new macros. gcc/testsuite/ * c-c++-common/cpp/wide-narrow-predef-macros.c: New test. libcpp/ * charset.c (init_iconv_desc): Initialize "to" and "from" fields. * directives.c (cpp_get_narrow_charset_name): New function. (cpp_get_wide_charset_name): Likewise. * include/cpplib.h (cpp_get_narrow_charset_name): Prototype. (cpp_get_wide_charset_name): Likewise. * internal.h (cset_converter): Add "to" and "from" fields. --- gcc/c-family/c-cppbuiltin.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/c-family/c-cppbuiltin.c') diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 41914f6..7b7b07d 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -877,6 +877,13 @@ c_cpp_builtins (cpp_reader *pfile) define_language_independent_builtin_macros (pfile); + /* encoding definitions used by users and libraries */ + builtin_define_with_value ("__GNUC_EXECUTION_CHARSET_NAME", + cpp_get_narrow_charset_name (pfile), 1); + builtin_define_with_value ("__GNUC_WIDE_EXECUTION_CHARSET_NAME", + cpp_get_wide_charset_name (pfile), 1); + + if (c_dialect_cxx ()) { int major; -- cgit v1.1