Go to file
Joseph Myers 7c5890cc0a Support UTF-8 character constants for C2x.
C2x adds u8'' character constants to C.  This patch adds the
corresponding GCC support.

Most of the support was already present for C++ and just needed
enabling for C2x.  However, in C2x these constants have type unsigned
char, which required corresponding adjustments in the compiler and the
preprocessor to give them that type for C.

For C, it seems clear to me that having type unsigned char means the
constants are unsigned in the preprocessor (and thus treated as having
type uintmax_t in #if conditionals), so this patch implements that.  I
included a conditional in the libcpp change to avoid affecting
signedness for C++, but I'm not sure if in fact these constants should
also be unsigned in the preprocessor for C++ in which case that
!CPP_OPTION (pfile, cplusplus) conditional would not be needed.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/c:
	* c-parser.c (c_parser_postfix_expression)
	(c_parser_check_literal_zero): Handle CPP_UTF8CHAR.
	* gimple-parser.c (c_parser_gimple_postfix_expression): Likewise.

gcc/c-family:
	* c-lex.c (lex_charconst): Make CPP_UTF8CHAR constants unsigned
	char for C.

gcc/testsuite:
	* gcc.dg/c11-utf8char-1.c, gcc.dg/c2x-utf8char-1.c,
	gcc.dg/c2x-utf8char-2.c, gcc.dg/c2x-utf8char-3.c,
	gcc.dg/gnu2x-utf8char-1.c: New tests.

libcpp:
	* charset.c (narrow_str_to_charconst): Make CPP_UTF8CHAR constants
	unsigned for C.
	* init.c (lang_defaults): Set utf8_char_literals for GNUC2X and
	STDC2X.

From-SVN: r278265
2019-11-14 20:18:33 +00:00
config
contrib download_prerequisites: Use http instead of ftp for downloading. 2019-11-13 19:48:52 +02:00
fixincludes
gcc Support UTF-8 character constants for C2x. 2019-11-14 20:18:33 +00:00
gnattools
gotools
include GCN libgomp port 2019-11-13 12:38:04 +00:00
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcpp Support UTF-8 character constants for C2x. 2019-11-14 20:18:33 +00:00
libdecnumber
libffi
libgcc Update the arm-*-vxworks* support 2019-11-14 16:11:30 +00:00
libgfortran PR fortran/92470 Fixes for CFI_address 2019-11-13 12:13:57 +01:00
libgo libgo: fix DejaGNU testsuite compiler when using build sysroot 2019-11-11 23:28:54 +00:00
libgomp GCN Libgomp Plugin 2019-11-13 12:38:18 +00:00
libhsail-rt
libiberty PR c++/91979 - mangling nullptr expression 2019-11-04 18:24:25 -05:00
libitm
libobjc
liboffloadmic
libphobos
libquadmath
libsanitizer Enable libsanitizer build on riscv64 2019-11-13 09:45:15 +00:00
libssp
libstdc++-v3 libstdc++: Implement new predicate concepts from P1716R3 2019-11-14 16:53:18 +00:00
libvtv
lto-plugin
maintainer-scripts update_version_svn (IGNORE_BRANCHES): Add 7. 2019-11-14 07:41:56 +00:00
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Bump minimum MPFR version to 3.1.0 2019-11-11 17:59:48 +02:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Bump minimum MPFR version to 3.1.0 2019-11-11 17:59:48 +02:00
configure.ac Bump minimum MPFR version to 3.1.0 2019-11-11 17:59:48 +02:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.