Commit Graph

1193 Commits

Author SHA1 Message Date
Seija Kijin
16b00dc63f Make strstr.c in libiberty ANSI compliant
libiberty/

	* strstr.c (strstr): Make implementation ANSI/POSIX compliant.
2020-11-13 11:53:16 -07:00
GCC Administrator
0f5f9ed5e5 Daily bump. 2020-11-12 00:16:39 +00:00
Patrick Palka
b1c9b3c340 c++: Change the mangling of __alignof__ [PR88115]
This patch changes the mangling of __alignof__ to v111__alignof__,
making its mangling distinct from that of alignof(type) and
alignof(expr).

How we mangle ALIGNOF_EXPR now depends on its ALIGNOF_EXPR_STD_P flag,
which after the previous patch gets consistently set for alignof(type)
as well as alignof(expr).

gcc/c-family/ChangeLog:

	PR c++/88115
	* c-opts.c (c_common_post_options): Update latest_abi_version.

gcc/ChangeLog:

	PR c++/88115
	* common.opt (-fabi-version): Document =15.
	* doc/invoke.texi (C++ Dialect Options): Likewise.

gcc/cp/ChangeLog:

	PR c++/88115
	* mangle.c (write_expression): Mangle __alignof_ differently
	from alignof when the ABI version is at least 15.

libiberty/ChangeLog:

	PR c++/88115
	* cp-demangle.c (d_print_comp_inner)
	<case DEMANGLE_COMPONENT_EXTENDED_OPERATOR>: Don't print the
	"operator " prefix for __alignof__.
	<case DEMANGLE_COMPONENT_UNARY>: Always print parens around the
	operand of __alignof__.
	* testsuite/demangle-expected: Test demangling for __alignof__.

gcc/testsuite/ChangeLog:

	PR c++/88115
	* g++.dg/abi/macro0.C: Adjust.
	* g++.dg/cpp0x/alignof7.C: New test.
	* g++.dg/cpp0x/alignof8.C: New test.
2020-11-11 15:11:23 -05:00
GCC Administrator
2bee28dd41 Daily bump. 2020-11-10 00:16:24 +00:00
Christophe Lyon
946b73c113 libiberty/pex-win32.c: Initialize orig_err
Initializing orig_err avoids a warning: "may be used uninitialized".
See 97108.

2020-09-14  Torbjörn SVENSSON <torbjorn.svensson@st.com>
	Christophe Lyon  <christophe.lyon@linaro.org>

	libiberty/
	* pex-win32.c (pex_win32_exec_child): Initialize orig_err.
2020-11-09 07:15:15 +00:00
GCC Administrator
8e97b9052d Daily bump. 2020-10-07 00:16:35 +00:00
Martin Liska
190c04ba36 lto: fix LTO debug sections copying.
readelf -S prints:

There are 81999 section headers, starting at offset 0x1f488060:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 01404f 00     81998   0  0
  [ 1] .group            GROUP           0000000000000000 000040 000008 04     81995 105027  4
...
  [81995] .symtab           SYMTAB          0000000000000000 d5d9298 2db310 18     81997 105026  8
  [81996] .symtab_shndx     SYMTAB SECTION INDICES 0000000000000000 d8b45a8 079dd8 04     81995   0  4
  [81997] .strtab           STRTAB          0000000000000000 d92e380 80460c 00      0   0  1
...

Looking at the documentation:
Table 7–15 ELF sh_link and sh_info Interpretation

sh_type - sh_link
SHT_SYMTAB - The section header index of the associated string table.
SHT_SYMTAB_SHNDX - The section header index of the associated symbol table.

As seen, sh_link of a SHT_SYMTAB always points to a .strtab and readelf
confirms that.

So we need to use reverse mapping taken from
  [81996] .symtab_shndx     SYMTAB SECTION INDICES 0000000000000000 d8b45a8 079dd8 04     81995   0  4

where sh_link points to 81995.

libiberty/ChangeLog:

	PR lto/97290
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Use sh_link of a .symtab_shndx section.
2020-10-06 16:07:02 +02:00
GCC Administrator
a2b7397b50 Daily bump. 2020-09-25 00:16:27 +00:00
Mark Wielaard
942ab9e9d4 libiberty: Add get_DW_UT_name and update include/dwarf2.{def,h}
This adds a get_DW_UT_name function to dwarfnames using dwarf2.def
for use in binutils readelf to show the unit types in a DWARF5 header.

Also remove DW_CIE_VERSION which was already removed in binutils/gdb
and is not used in gcc.

include/ChangeLog:

	* dwarf2.def: Add DWARF5 Unit type header encoding macros
	DW_UT_FIRST, DW_UT and DW_UT_END.
	* dwarf2.h (enum dwarf_unit_type): Removed and define using
	DW_UT_FIRST, DW_UT and DW_UT_END macros.
	(DW_CIE_VERSION): Removed.
	(get_DW_UT_name): New function declaration.

libiberty/ChangeLog:

	* dwarfnames.c (get_DW_UT_name): Define using DW_UT_FIRST, DW_UT
	and DW_UT_END.
2020-09-24 22:37:10 +02:00
GCC Administrator
31a0504624 Daily bump. 2020-09-09 00:16:29 +00:00
Felix Willgerodt
87603e5656 floatformat.h: Add bfloat16 support.
This change is motivated by a patchset that adds bfloat16 debugging
support for new avx512 instructions to GDB. The gdb thread can be found
here: https://sourceware.org/pipermail/gdb-patches/2020-July/170820.html

include:
2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

	* floatformat.h (floatformat_bfloat16_big): New.
	(floatformat_bfloat16_little): New.

libiberty:
2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

	* floatformat.c (floatformat_bfloat16_big): New.
	(floatformat_bfloat16_little): New.
2020-09-08 17:38:12 +00:00
Alan Modra
fff56ce438 ubsan: d-demangle.c:214 signed integer overflow
Running the libiberty testsuite
./test-demangle < libiberty/testsuite/d-demangle-expected
libiberty/d-demangle.c:214:14: runtime error: signed integer overflow: 922337203 * 10 cannot be represented in type 'long int'

On looking at silencing ubsan, I found a real bug in dlang_number.
For a 32-bit long, some overflows won't be detected.  For example,
21474836480.  Why?  Well 214748364 * 10 is 0x7FFFFFF8 (no overflow so
far).  Adding 8 gives 0x80000000 (which does overflow but there is no
test for that overflow in the code).  Then multiplying 0x80000000 * 10
= 0x500000000 = 0 won't be caught by the multiplication overflow test.
The same holds for a 64-bit long using similarly crafted digit
sequences.

	* d-demangle.c: Include limits.h.
	(ULONG_MAX, UINT_MAX): Provide fall-back definition.
	(dlang_number): Simplify and correct overflow test.  Only
	write *ret on returning non-NULL.  Make "ret" an unsigned long*.
	Only succeed for result of [0,UINT_MAX].
	(dlang_decode_backref): Simplify and correct overflow test.
	Only write *ret on returning non-NULL.  Only succeed for
	result [1,MAX_LONG].
	(dlang_backref): Remove now unnecessary range check.
	(dlang_symbol_name_p): Likewise.
	(string_need): Take a size_t n arg, and use size_t tem.
	(string_append): Use size_t n.
	(string_appendn, string_prependn): Take a size_t n arg.
	(TEMPLATE_LENGTH_UNKNOWN): Define as -1UL.
	(dlang_lname, dlang_parse_template): Take an unsigned long len
	arg.
	(dlang_symbol_backref, dlang_identifier, dlang_parse_integer),
	(dlang_parse_integer, dlang_parse_string),
	(dlang_parse_arrayliteral, dlang_parse_assocarray),
	(dlang_parse_structlit, dlang_parse_tuple),
	(dlang_template_symbol_param, dlang_template_args): Use
	unsigned long variables.
	* testsuite/d-demangle-expected: Add new tests.
2020-09-08 10:45:15 +09:30
GCC Administrator
57ea089421 Daily bump. 2020-08-27 00:16:27 +00:00
Iain Buclaw
387d0773f3 libiberty: Add support for in' and in ref' storage classes.
The storage class `in' is now a first-class citizen with its own mangle
symbol, of which also permits `in ref'.  Previously, `in' was an alias
to `const [scope]', which is a type constructor.

The mangle symbol repurposed for this is `I', which was originally used
by identifier types.  However, while TypeIdentifier is part of the
grammar, it must be resolved to some other entity during the semantic
passes, and so shouldn't appear anywhere in the mangled name.

Old tests that are now no longer valid have been removed.

libiberty/ChangeLog:

	* d-demangle.c (dlang_function_args): Handle 'in' and 'in ref'
	parameter storage classes.
	(dlang_type): Remove identifier type.
	* testsuite/d-demangle-expected: Update tests.
2020-08-26 10:03:56 +02:00
GCC Administrator
6a1ad710ad Daily bump. 2020-08-04 00:16:24 +00:00
Richard Biener
b32c5d0b72 lto/96385 - avoid unused global UNDEFs in debug objects
Unused global UNDEFs can have side-effects in some circumstances so
the following patch avoids them by treating them the same as other
to be discarded DEFs - make them local.

2020-08-03  Richard Biener  <rguenther@suse.de>

	PR lto/96385
libiberty/
	* simple-object-elf.c
	(simple_object_elf_copy_lto_debug_sections): Localize global
	UNDEFs and reuse the prevailing name.
2020-08-03 15:09:20 +02:00
GCC Administrator
d48cca8f21 Daily bump. 2020-07-31 00:16:26 +00:00
H.J. Lu
4712bde3ca Require CET support only for the final GCC build
With --enable-cet, require CET support only for the final GCC build.
Don't enable CET without CET support for non-bootstrap build, in stage1
nor for build support.

config/

	PR bootstrap/96202
	* cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
	support in stage1 nor for build support.

gcc/

	PR bootstrap/96202
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/96202
	* configure: Regenerated.

libcc1/

	PR bootstrap/96202
	* configure: Regenerated.

libcpp/

	PR bootstrap/96202
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/96202
	* configure: Regenerated.

libiberty/

	PR bootstrap/96202
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/96202
	* configure: Regenerated.
2020-07-30 05:36:24 -07:00
GCC Administrator
8ca07a3072 Daily bump. 2020-07-15 00:16:35 +00:00
Ian Lance Taylor
bae45b8be5 demangler: don't treat lambda as a substitution candidate
libiberty/ChangeLog:

	PR demangler/96143
	* cp-demangle.c (d_lambda): Don't add substitution candidate.
	* testsuite/demangle-expected: Update a few existing test cases
	accordingly, and add a new test case.
2020-07-14 10:25:48 -07:00
GCC Administrator
865362954f Daily bump. 2020-07-11 00:16:31 +00:00
Jason Merrill
6324c52bba c++: Support non-type template parms of union type.
Another thing newly allowed by P1907R1.  The ABI group has discussed
representing unions with designated initializers, and has separately
specified how to represent designators; this patch implements both.

gcc/cp/ChangeLog:

	* tree.c (structural_type_p): Allow unions.
	* mangle.c (write_expression): Express unions with a designator.

libiberty/ChangeLog:

	* cp-demangle.c (cplus_demangle_operators): Add di, dx, dX.
	(d_expression_1): Handle di and dX.
	(is_designated_init, d_maybe_print_designated_init): New.
	(d_print_comp_inner): Use d_maybe_print_designated_init.
	* testsuite/demangle-expected: Add designator tests.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/nontype-class-union1.C: New test.
2020-07-10 08:36:50 -04:00
GCC Administrator
c9c05f7323 Daily bump. 2020-06-27 00:16:24 +00:00
Nick Clifton
87fce92c5c This patch removes the use of the "register" keyword from the bsearch() and bsearch_r() functions supplied by libiberty. The register keyword is deprecated in C++17.
2020-06-25  Nick Clifton  <nickc@redhat.com>

include/
	* libiberty.h (bsearch_r): Remove use of the register keyword from
	the prototype.

libiberty/
	* bsearch.c (bsearch): Remove use of register keyword.
	* bsearch_r.c (bsearch_r): Likewise.
2020-06-26 10:06:48 +01:00
GCC Administrator
4543acc874 Daily bump. 2020-06-24 00:16:31 +00:00
Nick Alcock
aec24341d0 libiberty, include: add bsearch_r
libctf wants a bsearch that takes a void * arg pointer to avoid a
nonportable use of __thread.

bsearch_r is required, not optional, at this point because as far as I
can see this obvious-sounding function is not implemented by anyone's
libc.  We can easily move it to AC_LIBOBJ later if it proves necessary
to do so.

include/
	* libiberty.h (bsearch_r): New.
libiberty/
	* bsearch_r.c: New file.
	* Makefile.in (CFILES): Add bsearch_r.c.
	(REQUIRED_OFILES): Add bsearch_r.o.
	* functions.texi: Regenerate.
2020-06-23 18:39:38 +02:00
GCC Administrator
885ef72f27 Daily bump. 2020-05-30 00:16:27 +00:00
H.J. Lu
9051b54827 Avoid nested save_CFLAGS and save_LDFLAGS
Avoid nested save_CFLAGS and save_LDFLAGS by replacing save_CFLAGS and
save_LDFLAGS with cet_save_CFLAGS and cet_save_LDFLAGS in cet.m4.

config/

	PR bootstrap/95413
	* cet.m4: Replace save_CFLAGS and save_LDFLAGS with
	cet_save_CFLAGS and cet_save_LDFLAGS.

gcc/

	PR bootstrap/95413
	* configure: Regenerated.

libatomic/

	PR bootstrap/95413
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/95413
	* configure: Regenerated.

libcc1/

	PR bootstrap/95413
	* configure: Regenerated.

libcpp/

	PR bootstrap/95413
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/95413
	* configure: Regenerated.

libgcc/

	PR bootstrap/95413
	* configure: Regenerated.

libgfortran/

	PR bootstrap/95413
	* configure: Regenerated.

libgomp/

	PR bootstrap/95413
	* configure: Regenerated.

libiberty/

	PR bootstrap/95413
	* configure: Regenerated.

libitm/

	PR bootstrap/95413
	* configure: Regenerated.

libobjc/

	PR bootstrap/95413
	* configure: Regenerated.

libphobos/

	PR bootstrap/95413
	* configure: Regenerated.

libquadmath/

	PR bootstrap/95413
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/95413
	* configure: Regenerated.

libssp/

	PR bootstrap/95413
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/95413
	* configure: Regenerated.

libvtv/

	PR bootstrap/95413
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/95413
	* configure: Regenerated.

zlib/

	PR bootstrap/95413
	* configure: Regenerated.
2020-05-29 12:56:40 -07:00
Iain Buclaw
3a55774f0b libiberty: Handle @live attribute in D demangler.
Adds support for demangling D functions annotated with the new
ownership/borrowing system attribute.

libiberty/ChangeLog:

	* d-demangle.c (dlang_attributes): Add @live attribute.
	* testsuite/d-demangle-expected: Add new tests.
2020-05-15 10:40:47 +02:00
Iain Buclaw
3f30a27491 libiberty: Update D symbol demangling for latest ABI spec.
Some small improvements and clarifications have been done in the D ABI
specification to remove all ambiguities found in the current grammar,
this implementation now more closely resembles the spec, whilst
maintaining compatibility with the old ABI.

Three new rules have been added to the ABI.

1. Back references using 'Q', analogous to C++ substitutions, compresses
   repeated identifiers, types, and template symbol and value parameters.

2. Template aliases to externally mangled symbols are prefixed with 'X'.
   This includes any symbol that isn't extern(D), or has its name
   overriden with pragma(mangle).  This fixes an ambiguity where it was
   not clear whether 'V' was an encoded calling convention, or the next
   template value parameter.

3. Alias parameters, templates, and tuple symbols no longer encode the
   symbol length of its subpart.  Tuples are now terminated with 'Z'.
   This fixes another ambiguity where the first character of the mangled
   name can be a digit as well, so the demangler had to figure out where
   to split the two adjacent numbers by trying out each combination.

libiberty/ChangeLog:

	* d-demangle.c (enum dlang_symbol_kinds): Remove enum.
	(struct dlang_info): New struct
	(dlang_decode_backref): New function.
	(dlang_backref): New function.
	(dlang_symbol_backref): New function.
	(dlang_type_backref): New function.
	(dlang_symbol_name_p): New function.
	(dlang_function_type_noreturn): New function.
	(dlang_function_type): Add 'info' parameter.  Decode function type
	with dlang_function_type_noreturn.
	(dlang_function_args): Add 'info' parameter.
	(dlang_type): Add 'info' parameter.  Handle back referenced types.
	(dlang_identifier): Replace 'kind' parameter with 'info'.  Handle back
	referenced symbols.  Split off decoding of plain identifiers to...
	(dlang_lname): ...here.
	(dlang_parse_mangle): Replace 'kind' parameter with 'info'.  Decode
	function type and return with dlang_type.
	(dlang_parse_qualified): Replace 'kind' parameter with 'info', add
	'suffix_modifier' parameter.  Decode function type with
	dlang_function_type_noreturn.
	(dlang_parse_tuple): Add 'info' parameter.
	(dlang_template_symbol_param): New function.
	(dlang_template_args): Add 'info' parameter.  Decode symbol parameter
	with dlang_template_symbol_param.  Handle back referenced values, and
	externally mangled parameters.
	(dlang_parse_template): Add 'info' parameter.
	(dlang_demangle_init_info): New function.
	(dlang_demangle): Initialize and pass 'info' parameter.
	* testsuite/d-demangle-expected: Add new tests.

Co-Authored-By: Rainer Schuetze <r.sagitario@gmx.de>
2020-05-14 23:43:17 +02:00
H.J. Lu
d17cdc17c9 Enable CET in cross compiler if possible
Don't perform CET run-time check for host when cross compiling.  Instead,
enable CET in cross compiler if possible so that it will run on both CET
and non-CET hosts.

config/

	PR bootstrap/94998
	* cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if
	possible.

libiberty/

	PR bootstrap/94998
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94998
	* configure: Regenerated.
2020-05-12 10:39:54 -07:00
H.J. Lu
eedc73a224 Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work first
GCC_CET_HOST_FLAGS uses -Wl,-z,ibt,-z,shstk to check if Linux/x86 host
has Intel CET enabled by introducing an Intel CET violation on purpose.
To avoid false positive, check whether -Wl,-z,ibt,-z,shstk works first.
-fcf-protection=none is added to avoid false negative when -fcf-protection
is enabled by default.

config/

	PR bootstrap/94739
	* cet.m4 (GCC_CET_HOST_FLAGS): Add -fcf-protection=none to
	-Wl,-z,ibt,-z,shstk.  Check whether -fcf-protection=none
	-Wl,-z,ibt,-z,shstk works first.

libiberty/

	PR bootstrap/94739
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94739
	* configure: Regenerated.
2020-04-28 05:42:50 -07:00
Jakub Jelinek
76458c912b demangler: Handle <=> operator in the demangler [PR94797]
The demangler didn't handle spaceship operator.

2020-04-27  Jakub Jelinek  <jakub@redhat.com>

	PR demangler/94797
	* cp-demangle.c (cplus_demangle_operators): Add ss <=> operator.
	* testsuite/demangle-expected: Add operator<=> test.
2020-04-27 20:59:25 +02:00
H.J. Lu
8fc8bf801e Enable Intel CET in liblto_plugin.so on Intel CET enabled host
Since ld is Intel CET enabled on Intel CET enabled host, dlopen fails on
liblto_plugin.so if it isn't Intel CET enabled.  Add GCC_CET_HOST_FLAGS
to cet.m4, use it in libiberty and lto-plugin to always enable Intel
CET in liblto_plugin.so on Intel CET enabled host.

On Linux/x86 host, enable Intel CET by default if assembler and compiler
support Intel CET so that the generated liblto_plugin.so can be used on
both CET and non-CET machines.  It is an error to disable Intel CET in
liblto_plugin.so on Intel CET enabled host.

config/

	PR bootstrap/94739
	* cet.m4 (GCC_CET_HOST_FLAGS): New.

libiberty/

	PR bootstrap/94739
	* Makefile.in (COMPILE.c): Add @CET_HOST_FLAGS@.
	(configure_deps): Add $(srcdir)/../config/cet.m4 and
	$(srcdir)/../config/enable.m4.
	* aclocal.m4: Include ../config/cet.m4 and ../config/enable.m4.
	* configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
	AC_SUBST(CET_HOST_FLAGS).
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94739
	* Makefile.am (AM_CFLAGS): Add $(CET_HOST_FLAGS).
	* configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
	AC_SUBST(CET_HOST_FLAGS).
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
2020-04-25 10:07:16 -07:00
Richard Biener
c9f90a25d4 Keep .GCC.command.line sections of LTO objetcs
This patch is for .GCC.command.line sections in LTO objects to be copied
into the final objects as in the following example:

[egeyar@localhost lto]$ gcc -flto -O3 demo.c -c -g --record-gcc-command-line
[egeyar@localhost lto]$ gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2
[egeyar@localhost lto]$ gcc demo.o demo2.o -o a.out
[egeyar@localhost lto]$ readelf -p .GCC.command.line a.out

String dump of section '.GCC.command.line':
  [     0]  10.0.1 20200227 (experimental) : gcc -flto -O3 demo.c -c -g --record-gcc-command-line
  [    56]  10.0.1 20200227 (experimental) : gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2

2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

	* simple-object.c (handle_lto_debug_sections): Name
	".GCC.command.line" among debug sections to be copied over
	from lto objects.
2020-03-05 08:44:11 +01:00
Nick Clifton
3bb6abbf4b Fix a libiberty testsuite failure
* testsuite/demangle-expected: Update expected demangling of
	enable_if pattern.
2020-03-02 03:50:34 -08:00
H.J. Lu
577350603a lto: Also copy .note.gnu.property section
When generating the separate file with LTO debug sections, we should
also copy .note.gnu.property section.

	PR lto/93966
	* simple-object.c (handle_lto_debug_sections): Also copy
	.note.gnu.property section.
2020-03-02 03:09:08 -08:00
Sandra Loosemore
02ce382cd3 Use a non-empty test program to test ability to link.
On bare-metal targets, I/O support is typically provided by a BSP and
requires a linker script and/or hosting library to be specified on the
linker command line.  Linking an empty program with the default linker
script may succeed, however, which confuses libstdc++ configuration
when programs that probe for the presence of various I/O features fail
with link errors.

2020-02-12  Sandra Loosemore  <sandra@codesourcery.com>

	PR libstdc++/79193
	PR libstdc++/88999

	config/
	* no-executables.m4: Use a non-empty program to test for linker
	support.

	libgcc/
	* configure: Regenerated.

	libgfortran/
	* configure: Regenerated.

	libiberty/
	* configure: Regenerated.

	libitm/
	* configure: Regenerated.

	libobjc/
	* configure: Regenerated.

	libquadmath/
	* configure: Regenerated.

	libssp/
	* configure: Regenerated.

	libstdc++v-3/
	* configure: Regenerated.
2020-02-12 13:22:07 -08:00
Andrew Burgess
5f44a4341c libiberty/hashtab: More const parameters
Makes some parameters const in libiberty's hashtab library.

include/ChangeLog:

        * hashtab.h (htab_remove_elt): Make a parameter const.
        (htab_remove_elt_with_hash): Likewise.

libiberty/ChangeLog:

        * hashtab.c (htab_remove_elt): Make a parameter const.
        (htab_remove_elt_with_hash): Likewise.
2020-02-05 13:01:06 +00:00
Alexandre Oliva
18193e8f00 [libiberty] output empty args as a pair of quotes
writeargv writes out empty arguments in a way that expandargv skips
them instead of preserving them.  Fixed by writing out a pair of
quotes for them.


for  libiberty/ChangeLog

	* argv.c (writeargv): Output empty args as "".
2020-01-23 16:45:24 -03:00
Iain Sandoe
7ebbff3acb [libiberty] Update demangler to handle co_await operator.
C++20 coroutines introduces a new operator with a mangling of 'aw'.
This patch adds that to libiberty's demangler.

libiberty/ChangeLog:

2020-01-18  Iain Sandoe  <iain@sandoe.co.uk>

	* cp-demangle.c (cplus_demangle_operators): Add the co_await
	operator.
	* testsuite/demangle-expected: Test co_await operator mangling.
2020-01-18 12:15:12 +00:00
Jakub Jelinek
8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Tim Ruehsen
1cd4fe3d43 Fix read buffer overflow in split_directories
* make-relative-prefix.c (split_directories):
        Return early on empty 'name'

From-SVN: r279068
2019-12-06 15:20:06 -07:00
Jeff Law
513e0aa0c4 [PATCH] Fix slowness in demangler
* cp-demangle.c (d_print_init): Remove const from 4th param.
	(cplus_demangle_fill_name): Initialize d->d_counting.
	(cplus_demangle_fill_extended_operator): Likewise.
	(cplus_demangle_fill_ctor): Likewise.
	(cplus_demangle_fill_dtor): Likewise.
	(d_make_empty): Likewise.
	(d_count_templates_scopes): Remobe const from 3rd param,
	Return on dc->d_counting > 1,
	Increment dc->d_counting.
        * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting.
	(cplus_demangle_fill_builtin_type): Likewise.
	(cplus_demangle_fill_operator): Likewise.

	* demangle.h (struct demangle_component): Add member
	d_counting.

From-SVN: r278359
2019-11-16 10:14:14 -07:00
Eduard-Mihai Burtescu
32fc3719e0 [PATCH] Refactor rust-demangle to be independent of C++ demangling.
* demangle.h (rust_demangle_callback): Add.

	* cplus-dem.c (cplus_demangle): Use rust_demangle directly.
	(rust_demangle): Remove.
	* rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash.
	(parse_lower_hex_nibble): Rename to decode_lower_hex_nibble.
	(parse_legacy_escape): Rename to decode_legacy_escape.
	(rust_is_mangled): Remove.
	(struct rust_demangler): Add.
	(peek): Add.
	(next): Add.
	(struct rust_mangled_ident): Add.
	(parse_ident): Add.
	(rust_demangle_sym): Remove.
	(print_str): Add.
	(PRINT): Add.
	(print_ident): Add.
	(rust_demangle_callback): Add.
	(struct str_buf): Add.
	(str_buf_reserve): Add.
	(str_buf_append): Add.
	(str_buf_demangle_callback): Add.
	(rust_demangle): Add.
	* rust-demangle.h: Remove.

From-SVN: r278358
2019-11-16 08:32:50 -07:00
Miguel Saldivar
f73cb38f65 * testsuite/demangle-expected: Fix test.
From-SVN: r278357
2019-11-16 07:45:30 -07:00
Kamlesh Kumar
e0c866ddfd PR c++/91979 - mangling nullptr expression
2019-11-04  Kamlesh Kumar  <kamleshbhalui@gmail.com>

gcc/cp
        * cp/mangle.c (write_template_arg_literal): Handle nullptr
        mangling.
gcc
	* common.opt (-fabi-version): Document =14.
	* doc/invoke.texi (C++ Dialect Options): Likewise.
gcc/c-family
        * c-opts.c (c_common_post_options): Update
        latest_abi_version.
libiberty
        * cp-demangle.c (d_expr_primary): Handle
        nullptr demangling.
        * testsuite/demangle-expected: Added test.

From-SVN: r277801
2019-11-04 18:24:25 -05:00
Paul Pluzhnikov
1c40e11956 cp-demangle.c (d_number): Avoid signed int overflow.
2019-10-29 Paul Pluzhnikov  <ppluzhnikov@google.com>

	* cp-demangle.c (d_number): Avoid signed int overflow.

From-SVN: r277575
2019-10-29 08:29:59 -07:00
Miguel Saldivar
420fb10c09 cp-demangle.c (d_print_mod): Add a space before printing complex and imaginary, as opposed to after.
* cp-demangle.c (d_print_mod): Add a space before printing `complex`
	and `imaginary`, as opposed to after.
	* testsuite/demangle-expected: Adjust test.

From-SVN: r277535
2019-10-28 13:14:48 -06:00
Eduard-Mihai Burtescu
e1cb00db67 rust-demangle.c (looks_like_rust): Remove.
* rust-demangle.c (looks_like_rust): Remove.
	(rust_is_mangled): Don't check escapes.
	(is_prefixed_hash): Allow 0-9a-f permutations.
	(rust_demangle_sym): Don't bail on unknown escapes.
	* testsuite/rust-demangle-expected: Update 'main::$99$' test.

From-SVN: r276539
2019-10-03 15:54:47 -06:00