Commit Graph

1001 Commits

Author SHA1 Message Date
Patrick Palka f3ce64372c Tweak the documentation of libiberty's xcrc32 function
libiberty/ChangeLog;

	* crc32.c: In the documentation, don't refer to GDB's
	now-nonexistent crc32 implementation.  In the table-generation
	program embedded within the documentation, change the type of
	the induction variables i and j from int to unsigned int, to
	avoid undefined behavior.

From-SVN: r231983
2015-12-28 22:00:14 +00:00
Nick Clifton f8e663301f re PR other/66827 (left shifts of negative value warnings due to C++14 switch)
PR 66827
	* regex.c (EXTRACT_NUMBER): Cast sign byte to unsigned before left
	shifting.

From-SVN: r231873
2015-12-21 08:23:35 +00:00
Pedro Alves 921da19854 PR other/61321 - demangler crash on casts in template parameters
The fix for bug 59195:

 [C++ demangler handles conversion operator incorrectly]
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59195

unfortunately makes the demangler crash due to infinite recursion, in
case of casts in template parameters.

For example, with:

 template<int> struct A {};
 template <typename Y> void function_temp(A<sizeof ((Y)(999))>) {}
 template void function_temp<int>(A<sizeof (int)>);

The 'function_temp<int>' instantiation above mangles to:

  _Z13function_tempIiEv1AIXszcvT_Li999EEE

The demangler parses this as:

typed name
  template
    name 'function_temp'
    template argument list
      builtin type int
  function type
    builtin type void
    argument list
      template                          (*)
        name 'A'
        template argument list
          unary operator
            operator sizeof
            unary operator
              cast
                template parameter 0    (**)
              literal
                builtin type int
                name '999'

And after the fix for 59195, due to:

 static void
 d_print_cast (struct d_print_info *dpi, int options,
	       const struct demangle_component *dc)
 {
 ...
   /* For a cast operator, we need the template parameters from
      the enclosing template in scope for processing the type.  */
   if (dpi->current_template != NULL)
     {
       dpt.next = dpi->templates;
       dpi->templates = &dpt;
       dpt.template_decl = dpi->current_template;
     }

when printing the template argument list of A (what should be "<sizeof
(int)>"), the template parameter 0 (that is, "T_", the '**' above) now
refers to the first parameter of the the template argument list of the
'A' template (the '*' above), exactly what we were already trying to
print.  This leads to infinite recursion, and stack exaustion.  The
template parameter 0 should actually refer to the first parameter of
the 'function_temp' template.

Where it reads "for the cast operator" in the comment in d_print_cast
(above), it's really talking about a conversion operator, like:

  struct A { template <typename U> explicit operator U(); };

We don't want to inject the template parameters from the enclosing
template in scope when processing a cast _expression_, only when
handling a conversion operator.

The problem is that DEMANGLE_COMPONENT_CAST is currently ambiguous,
and means _both_ 'conversion operator' and 'cast expression'.

Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type,
which does what DEMANGLE_COMPONENT_CAST does today, and making
DEMANGLE_COMPONENT_CAST just simply print its component subtree.

I think we could instead reuse DEMANGLE_COMPONENT_CAST and in
d_print_comp_inner still do:

 @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
        d_print_comp (dpi, options, dc->u.s_extended_operator.name);
        return;

     case DEMANGLE_COMPONENT_CAST:
       d_append_string (dpi, "operator ");
 -     d_print_cast (dpi, options, dc);
 +     d_print_conversion (dpi, options, dc);
       return;

leaving the unary cast case below calling d_print_cast, but seems to
me that spliting the component types makes it easier to reason about
the code.

g++'s testsuite actually generates three symbols that crash the
demangler in the same way.  I've added those as tests in the demangler
testsuite as well.

And then this fixes PR other/61233 too, which happens to be a
demangler crash originally reported to GDB, at:
https://sourceware.org/bugzilla/show_bug.cgi?id=16957

Bootstrapped and regtested on x86_64 Fedora 20.

Also ran this through GDB's testsuite.  GDB will require a small
update to use DEMANGLE_COMPONENT_CONVERSION in one place it's using
DEMANGLE_COMPONENT_CAST in its sources.

libiberty/
2015-11-27  Pedro Alves  <palves@redhat.com>

        PR other/61321
        PR other/61233
        * demangle.h (enum demangle_component_type)
        <DEMANGLE_COMPONENT_CONVERSION>: New value.
        * cp-demangle.c (d_demangle_callback, d_make_comp): Handle
        DEMANGLE_COMPONENT_CONVERSION.
        (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
        instead of DEMANGLE_COMPONENT_CAST.
        (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
        component if handling a conversion.
        (d_count_templates_scopes, d_print_comp_inner): Handle
        DEMANGLE_COMPONENT_CONVERSION.
        (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
        of DEMANGLE_COMPONENT_CAST.
        (d_print_cast): Rename as ...
        (d_print_conversion): ... this.  Adjust comments.
        (d_print_cast): Rewrite - simply print the left subcomponent.
        * cp-demint.c (cplus_demangle_fill_component): Handle
        DEMANGLE_COMPONENT_CONVERSION.

        * testsuite/demangle-expected: Add tests.

From-SVN: r231020
2015-11-27 14:48:21 +00:00
Mike Stump 633ce97157 * Makefile.in (etags tags TAGS): Use && instead of ;.
From-SVN: r230270
2015-11-12 19:18:54 +00:00
Alan Modra 61c94e79eb Configury changes for obstack optimization
Missed from last patch

	* config.in: Regenerate.

From-SVN: r229991
2015-11-09 15:24:15 +10:30
Alan Modra 126e0b6b61 Configury changes for obstack optimization
* configure.ac: Check size of size_t.
	* configure: Regenerate.

From-SVN: r229990
2015-11-09 15:02:08 +10:30
Alan Modra a186d523f2 Silence obstack.c -Wc++compat warning
* obstack.c (_obstack_newchunk): Silence -Wc++compat warning.
	(_obstack_begin_worker): Likewise.  Move assignment to h->chunk
	after alloc failure check.

From-SVN: r229989
2015-11-09 15:00:26 +10:30
Alan Modra f0e525fe18 Modify obstack.[hc] to avoid having to include other gnulib files
Using the standard gnulib obstack source requires importing quite a
lot of other files from gnulib, and requires build changes.

include/
	* obstack.h (__attribute_pure__): Expand _GL_ATTRIBUTE_PURE.
libiberty/
	* obstack.c (__alignof__): Expand alignof_type from alignof.h.
	(obstack_exit_failure): Don't use exitfail.h.
	(_): Include libintl.h when HAVE_LIBINTL_H and nls enabled.
	Provide default.  Don't include gettext.h.
	(_Noreturn): Define.
	* obstacks.texi: Adjust node references to external libc info files.

From-SVN: r229988
2015-11-09 14:58:21 +10:30
Alan Modra c9f265c945 Copy gnulib obstack files
This copies obstack.[ch] from gnulib, and updates the docs.  The next
patch should be applied if someone repeats the import at a later date.

include/
	* obstack.h: Import current gnulib file.
libiberty/
	* obstack.c: Import current gnulib file.
	* obstacks.texi: Updated doc, from glibc's manual/memory.texi.

From-SVN: r229987
2015-11-09 14:56:32 +10:30
Joel Brobecker 41fdbd5440 Do not use libiberty's getpagesize on Android
libiberty/ChangeLog:

        * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
        Android hosts.
        * configure: Regenerate.

From-SVN: r229893
2015-11-06 21:37:49 +00:00
Jason Merrill 08585fba89 Make-lang.in (c.tags): Also include libcpp TAGS.
gcc/c/
	* Make-lang.in (c.tags): Also include libcpp TAGS.
gcc/cp/
	* Make-lang.in (c++.tags): Also include libcpp TAGS.

From-SVN: r229504
2015-10-28 15:45:33 -04:00
Roland McGrath efd40fc416 Fix PR63758 by using the _NSGetEnviron() API on Darwin
include/

	Roland McGrath  <roland@gnu.org>

	PR other/63758
	* environ.h: New file.

libiberty/

	Roland McGrath  <roland@gnu.org>
	Iain Sandoe  <iain@codesourcery.com>

	PR other/63758
	* pex-unix.c: Obtain the environment interface from settings in environ.h
	rather than in-line code.  Update copyright date.
	* setenv.c: Likewise.
	* xmalloc.c: Likewise.



Co-Authored-By: Iain Sandoe <iain@codesourcery.com>

From-SVN: r228942
2015-10-18 10:33:37 +00:00
Jason Merrill b8fd7909c0 Implement N4514, C++ Extensions for Transactional Memory.
gcc/
	* builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute.
gcc/c-family/
	* c-common.c (c_common_reswords): Add C++ TM TS keywords.
	(c_common_attribute_table): Add transaction_safe_dynamic.
	transaction_safe now affects type identity.
	(handle_tm_attribute): Handle transaction_safe_dynamic.
	* c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT,
	RID_ATOMIC_CANCEL, RID_SYNCHRONIZED.
	(OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED.
	(D_TRANSMEM): New.
	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory.
	* c-pretty-print.c (pp_c_attributes_display): Don't print
	transaction_safe in C++.
gcc/c/
	* c-parser.c (c_lex_one_token): Handle @synchronized.
	* c-decl.c (match_builtin_function_types): A declaration of a built-in
	can change whether the function is transaction_safe.
gcc/cp/
	* cp-tree.h (struct cp_declarator): Add tx_qualifier field.
	(BCS_NORMAL, BCS_TRANSACTION): New enumerators.
	* lex.c (init_reswords): Limit TM kewords to -fgnu-tm.
	* parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized.
	(make_call_declarator): Take tx_qualifier.
	(cp_parser_tx_qualifier_opt): New.
	(cp_parser_lambda_declarator_opt): Use it.
	(cp_parser_direct_declarator): Likewise.
	(cp_parser_statement): Handle atomic_noexcept, atomic_cancel.
	(cp_parser_compound_statement): Change in_try parameter to bcs_flags.
	(cp_parser_std_attribute): Map optimize_for_synchronized to
	transaction_callable.
	(cp_parser_transaction): Take the token.  Handle atomic_noexcept.
	* lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety.
	* call.c (enum conversion_kind): Add ck_tsafe.
	(standard_conversion): Handle transaction-safety conversion.
	(convert_like_real, resolve_address_of_overloaded_function): Likewise.
	(check_methods): Diagnose transaction_safe_dynamic on non-virtual
	function.
	(look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic.
	* cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant)
	(can_convert_tx_safety): New.
	* typeck.c (composite_pointer_type): Handle transaction-safety.
	* name-lookup.h (enum scope_kind): Add sk_transaction.
	* name-lookup.c (begin_scope): Handle it.
	* semantics.c (begin_compound_stmt): Pass it.
	* decl.c (check_previous_goto_1): Check it.
	(struct named_label_entry): Add in_transaction_scope.
	(poplevel_named_label_1): Set it.
	(check_goto): Check it.
	(duplicate_decls): A specialization can be transaction_safe
	independently of its template.
	(grokdeclarator): Handle tx-qualifier.
	* rtti.c (ptr_initializer): Handle transaction-safe.
	* search.c (check_final_overrider): Check transaction_safe_dynamic.
	Don't check transaction_safe.
	* mangle.c (write_function_type): Mangle transaction_safe here.
	(write_CV_qualifiers_for_type): Not here.
	(write_type): Preserve transaction_safe when stripping attributes.
	* error.c (dump_type_suffix): Print transaction_safe.
libiberty/
	* cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe.
	(cplus_demangle_type): Let d_cv_qualifiers handle it.
	(d_dump, d_make_comp, has_return_type, d_encoding)
	(d_count_templates_scopes, d_print_comp_inner)
	(d_print_mod_list, d_print_mod, d_print_function_type)
	(is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE.

From-SVN: r228462
2015-10-04 15:17:19 -04:00
Ian Lance Taylor 68bac64063 cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags.
* cp-demangle.c (d_abi_tags): Preserve di->last_name across any
	ABI tags.

From-SVN: r226910
2015-08-15 13:23:30 +00:00
Iain Buclaw fd91ffb805 Fix test failure on Solaris 9 where strtod() does not accept hexadecimals
2015-08-11  Iain Buclaw  <ibuclaw@gdcproject.org>

libiberty/

	* d-demangle.c (dlang_parse_real): Remove call to strtod.
	(strtod): Remove declaration.
	* testsuite/d-demangle-expected: Update float and complex literal
	tests to check correct hexadecimal demangling.

From-SVN: r226774
2015-08-11 07:12:19 +00:00
Mikhail Maltsev 76d96a5a6f Fix several crashes of C++ demangler on fuzzed input.
libiberty/
	* cp-demangle.c (d_dump): Fix syntax error.
	(d_identifier): Adjust type of len to match d_source_name.
	(d_expression_1): Fix out-of-bounds access.  Check code variable for
	NULL before dereferencing it.
	(d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER.
	(d_print_comp_inner): Add NULL pointer check.
	* cp-demangle.h (d_peek_next_char): Define as inline function when
	CHECK_DEMANGLER is defined.
	(d_advance): Likewise.
	* testsuite/demangle-expected: Add new testcases.

From-SVN: r225727
2015-07-13 05:49:54 +00:00
Uros Bizjak 9b004cd378 getruntime.c (RUSAGE_SELF): Define if not already defined.
* getruntime.c (RUSAGE_SELF): Define if not already defined.
	(get_runtime): Use RUSAGE_SELF as argument 1 of getrusage call.

From-SVN: r225614
2015-07-09 17:06:00 +02:00
Uros Bizjak 62ee314561 getruntime.c (get_run_time): Use RUSAGE_SELF as argument 1 of getrusage call.
* getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as
	argument 1 of getrusage call.

From-SVN: r225534
2015-07-08 09:05:11 +02:00
Jason Merrill 603eaec49a re PR c++/44282 (fastcall is not mangled at all)
PR c++/44282
gcc/cp/
	* mangle.c (attr_strcmp): New.
	(write_CV_qualifiers_for_type): Also write out attributes that
	affect type identity.
	(write_type): Strip all attributes after writing qualifiers.
libiberty/
	* cp-demangle.c (cplus_demangle_type): Handle arguments to vendor
	extended qualifier.

From-SVN: r224007
2015-06-01 22:28:19 -04:00
Yunlian Jiang f50f17e670 libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is not defined.
include/:
	* libiberty.h (asprintf): Don't declare if HAVE_DECL_ASPRINTF is
	not defined.
libiberty/:
	* configure.ac: Add AC_GNU_SOURCE.
	* Makefile.in (COMPILE.c): Add -D_GNU_SOURCE.
	* configure, config.in: Rebuild.
	* floatformat.c (_GNU_SOURCE): Don't define if already defined.

From-SVN: r223589
2015-05-22 20:53:45 +00:00
Iain Buclaw 7e8655412c d-demangle.c (dlang_symbol_kinds): New enum.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_symbol_kinds): New enum.
	(dlang_parse_symbol): Update signature.  Handle an ambiguity between
	pascal functions and template value arguments.  Only check for a type
	if parsing a function, or at the top level.  Return failure if the
	entire symbol was not successfully demangled.
	(dlang_identifier): Update signature.  Handle an ambiguity between two
	adjacent digits in a mangled symbol string.
	(dlang_type): Update call to dlang_parse_symbol.
	(dlang_template_args): Likewise.
	(dlang_parse_template): Likewise.
	(dlang_demangle): Likewise.
	* testsuite/d-demangle-expected: Fix bad tests found, and add problematic
	examples to the unittests.

From-SVN: r223247
2015-05-16 16:50:30 +00:00
Iain Buclaw ed4cdb8502 d-demangle.c (dlang_template_args): Skip over specialized template parameters in mangled symbol.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_template_args): Skip over specialized template
	parameters in mangled symbol.
	* testsuite/d-demangle-expected: Add coverage and unittest for specialized
	template parameters.

From-SVN: r223246
2015-05-16 16:50:19 +00:00
Iain Buclaw 59251a7367 d-demangle.c (dlang_type): Handle cent and ucent types.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type): Handle cent and ucent types.
	* testsuite/d-demangle-expected: Add coverage tests for cent and ucent.

From-SVN: r223245
2015-05-16 16:50:08 +00:00
Iain Buclaw 7ce4461f37 d-demangle.c (dlang_attributes): Handle return attributes, ignoring return parameters in the mangled string.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_attributes): Handle return attributes, ignoring
	return parameters in the mangled string.  Return NULL if have encountered
	an unknown attribute.
	(dlang_function_args): Handle return parameters in the mangled string.
	* testsuite/d-demangle-expected: Add coverage tests for functions with
	return parameters and return attributes.

From-SVN: r223244
2015-05-16 16:49:57 +00:00
Iain Buclaw 5cc158e9a9 d-demangle.c (dlang_identifier): Check encoded length of identifier to verify strncmp matches entire string.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_identifier): Check encoded length of identifier
	to verify strncmp matches entire string.
	* testsuite/d-demangle-expected: Fix wrong test for postblit symbol.

From-SVN: r223243
2015-05-16 16:49:46 +00:00
Iain Buclaw fa66ced4bf d-demangle.c (dlang_type_modifiers): New function.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_type_modifiers): New function.
	(dlang_type_modifier_p): New function.
	(dlang_call_convention_p): Ignore any kind of type modifier.
	(dlang_type): Handle and emit the type modifier after delegate types.
	(dlang_parse_symbol): Handle and emit the type modifier after the symbol.
	* testsuite/d-demangle-expected: Add coverage tests for all valid
	usages of function symbols with type modifiers.

From-SVN: r223242
2015-05-16 16:49:35 +00:00
Iain Buclaw 76b41cad1c d-demangle.c (dlang_call_convention): Return NULL if have reached the end of the symbol, but expected something to read.
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_call_convention): Return NULL if have reached the
	end of the symbol, but expected something to read.
	(dlang_attributes): Likewise.
	(dlang_function_type): Likewise.
	(dlang_type): Likewise.
	(dlang_identifier): Likewise.
	(dlang_value): Likewise.

From-SVN: r223241
2015-05-16 16:49:25 +00:00
Iain Buclaw eb058b7de6 d-demangle.c (dlang_parse_string): Represent embedded whitespace or non-printable characters as hex or escape...
libiberty/ChangeLog:

2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>

	* d-demangle.c (dlang_parse_string): Represent embedded whitespace or
	non-printable characters as hex or escape sequences.
	* testsuite/d-demangle-expected: Add test for templates with tabs and
	newlines embedded into the signature.

From-SVN: r223240
2015-05-16 16:49:13 +00:00
Joel Brobecker f5e7f5900b libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
libiberty/ChangeLog:

        * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
        but not HAVE_SYS_TIME_H.

(fixes a build failure on LynxOS-178)

From-SVN: r222918
2015-05-08 17:14:26 +00:00
Eli Zaretskii ffa176b09b libiberty/setenv.c: Do not declare environ if defined as a macro.
2015-04-22  Eli Zaretskii  <eliz@gnu.org>

        * strerror.c <sys_nerr, sys_errlist>: Declare only if they aren't
        macros.
        * setenv.c <environ>: Declare only if not a macro.

From-SVN: r222335
2015-04-22 19:34:06 +00:00
Max Ostapenko 7701939727 Makefile.tpl (EXTRA_HOST_EXPORTS): New variables.
2015-04-14  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* Makefile.tpl (EXTRA_HOST_EXPORTS): New variables.
	(EXTRA_BOOTSTRAP_FLAGS): Likewise.
	(check-[+module+]): Add EXTRA_HOST_EXPORTS and EXTRA_BOOTSTRAP_FLAGS.
	* Makefile.in: Regenerate.

	libiberty/
	* testsuite/Makefile.in (LIBCFLAGS): Add LDFLAGS.

From-SVN: r222099
2015-04-14 19:14:04 +03:00
Jakub Jelinek cacf1f5906 re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.)
PR target/65351
config/
	* mh-darwin: Only apply -mdynamic-no-pic for m32 Darwin when the compiler in
	use supports -mno-dynamic-no-pic.
	* picflag.m4: Only append -mno-dynamic-no-pic for Darwin when -mdynamic-no-pic
	is present in CFLAGS.

libiberty/
	* configure: Regenerate.
libada/
	* configure: Regenerate.
libgcc/
	* configure: Regenerate.
gcc/
	* configure: Regenerate.


Co-Authored-By: Iain Sandoe <iain@codesourcery.com>

From-SVN: r221967
2015-04-10 06:43:52 +00:00
Jakub Jelinek e8a4ed3b9d re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.)
PR target/65351
config/
	* picflag.m4: Append -mno-dynamic-no-pic for Darwin.
libiberty/
	* configure: Regenerate.
libada/
	* configure: Regenerate.
libgcc/
	* configure: Regenerate.
gcc/
	* configure: Regenerate.

Co-Authored-By: Iain Sandoe <iain@codesourcery.com>

From-SVN: r221891
2015-04-07 11:57:46 +02:00
Eli Zaretskii b411ed0cee strerror.c: Do not declare sys_nerr or sys_errlist if already macros
This fixes a MinGW warning in libiberty/strerror.c

2015-01-19  Eli Zaretskii  <eliz@gnu.org>

        * strerror.c <sys_nerr, sys_errlist>: Declare only if they aren't
        macros.

From-SVN: r219849
2015-01-19 15:28:56 +00:00
Uros Bizjak e885091886 xasprintf.c: New file.
libiberty/ChangeLog:

	* xasprintf.c: New file.
	* Makefile.in (CFILES): Add xasprintf.c.
	(REQUIRED_OFILES): Add xasprintf.$(objext).
	(xasprintf.$(objext)): New target.
	* functions.texi: Regenerate.

include/ChangeLog:

	* libiberty.h (xasprintf): Declare.

gcc/ChangeLog:

	* gengtype.h (xasprintf): Remove declaration.
	* gengtype.c (xasprintf): Remove.


Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r219060
2014-12-24 17:22:51 +01:00
Uros Bizjak 01ca36af91 xvasprintf.c: New file.
* xvasprintf.c: New file.
	* vprintf-support.h: Likewise.
	* vprintf-support.c: Likewise.
	* Makefile.in (CFILES): Add vprintf-support.c, xvasprintf.c.
	(REQUIRED_OFILES): Add vprintf-support.$(objext), xvasprintf.$(objext).
	(vprintf-support.$(objext), xvasprintf.$(objext)): New targets.
	(vasprintf.$(objext)): Depend on $(srcdir)/vprintf-support.h.
	* functions.texi: Regenerate.
	* vasprintf.c (int_vasprintf): Use libiberty_vprintf_buffer_size.

include/ChangeLog:

	* libiberty.h (xvasprintf): Declare.

libcpp/ChangeLog:

	* directives.c (cpp_define_formatted): Use xvasprintf.


Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r218618
2014-12-11 09:15:37 +01:00
John David Anglin 7b5216ddac Commit missing change log entries.
From-SVN: r217974
2014-11-22 21:12:47 +00:00
Kirill Yukhin 43cf21c686 Cast strtol return to unsigned long
* testsuite/test-strtol.c (run_tests): Cast strtol return to
	unsigned long.

From-SVN: r217429
2014-11-12 08:24:30 -08:00
Anthony Brandon 3d00119cfb re PR driver/36312 (should refuse to overwrite input file with output file)
gcc/testsuite/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* gcc.misc-tests/output.exp: New test case for identical input and
	output files.

include/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* diagnostic-core.h: Add prototype for fatal_error.
	* diagnostic.c (fatal_error): New function fatal_error.
	* gcc.c (store_arg): Remove have_o_argbuf_index.
	(process_command): Check if input and output files are the same.
	* toplev.c (init_asm_output): Check if input and output files are
	the same.

libiberty/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* filename_cmp.c (canonical_filename_eq): New function to check if
	file names are the same.
	* functions.texi: Updated with documentation for new function.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r217391
2014-11-11 23:33:25 +00:00
David Malcolm 35485da996 Merger of dmalcolm/jit branch from git
ChangeLog:
	* ChangeLog.jit: New.
	* MAINTAINERS (Various Maintainers): Add myself as jit maintainer.

contrib/ChangeLog:
	* ChangeLog.jit: New.
	* jit-coverage-report.py: New file: a script to print crude
	code-coverage information for the libgccjit API.

gcc/ChangeLog:
	* ChangeLog.jit: New.
	* Makefile.in (doc_build_sys): New variable, set to "sphinx" if
	sphinx is installed, falling back to "texinfo" otherwise.
	(FULL_DRIVER_NAME): New variable, adapted from the
	install-driver target.  New target, a symlink within the builddir,
	linked to "xgcc", for use when running the JIT library from the
	builddir.
	(MOSTLYCLEANFILES): Add FULL_DRIVER_NAME.
	(install-driver): Use $(FULL_DRIVER_NAME) rather than spelling it
	out.
	* configure.ac (doc_build_sys): New variable, set to "sphinx" if
	sphinx is installed, falling back to "texinfo" otherwise.
	(GCC_DRIVER_NAME): Generate a gcc-driver-name.h file containing
	GCC_DRIVER_NAME for the benefit of jit/internal-api.c.
	* configure: Regenerate.
	* doc/install.texi (--enable-host-shared): Specify that this is
	required when building libgccjit.
	(Tools/packages necessary for modifying GCC): Add Sphinx.
	* timevar.def (TV_JIT_REPLAY): New.
	(TV_ASSEMBLE): New.
	(TV_LINK): New.
	(TV_LOAD): New.

gcc/java/ChangeLog:
	* gcc/ChangeLog.jit: New.

gcc/jit/ChangeLog:
	* ChangeLog.jit: New.
	* ChangeLog: New.
	* Make-lang.in: New.
	* TODO.rst: New.
	* config-lang.in: New.
	* docs/Makefile: New.
	* docs/_build/texinfo/Makefile: New.
	* docs/_build/texinfo/factorial.png: New.
	* docs/_build/texinfo/libgccjit.texi: New.
	* docs/_build/texinfo/sum-of-squares.png: New.
	* docs/conf.py: New.
	* docs/examples/tut01-hello-world.c: New.
	* docs/examples/tut02-square.c: New.
	* docs/examples/tut03-sum-of-squares.c: New.
	* docs/examples/tut04-toyvm/Makefile: New.
	* docs/examples/tut04-toyvm/factorial.toy: New.
	* docs/examples/tut04-toyvm/fibonacci.toy: New.
	* docs/examples/tut04-toyvm/toyvm.c: New.
	* docs/index.rst: New.
	* docs/internals/index.rst: New.
	* docs/intro/factorial.png: New.
	* docs/intro/index.rst: New.
	* docs/intro/sum-of-squares.png: New.
	* docs/intro/tutorial01.rst: New.
	* docs/intro/tutorial02.rst: New.
	* docs/intro/tutorial03.rst: New.
	* docs/intro/tutorial04.rst: New.
	* docs/topics/contexts.rst: New.
	* docs/topics/expressions.rst: New.
	* docs/topics/functions.rst: New.
	* docs/topics/index.rst: New.
	* docs/topics/locations.rst: New.
	* docs/topics/objects.rst: New.
	* docs/topics/results.rst: New.
	* docs/topics/types.rst: New.
	* dummy-frontend.c: New.
	* jit-builtins.c: New.
	* jit-builtins.h: New.
	* jit-common.h: New.
	* jit-playback.c: New.
	* jit-playback.h: New.
	* jit-recording.c: New.
	* jit-recording.h: New.
	* libgccjit++.h: New.
	* libgccjit.c: New.
	* libgccjit.h: New.
	* libgccjit.map: New.
	* notes.txt: New.

gcc/testsuite/ChangeLog:
	* ChangeLog.jit: New.
	* jit.dg/all-non-failing-tests.h: New.
	* jit.dg/harness.h: New.
	* jit.dg/jit.exp: New.
	* jit.dg/test-accessing-struct.c: New.
	* jit.dg/test-accessing-union.c: New.
	* jit.dg/test-array-as-pointer.c: New.
	* jit.dg/test-arrays.c: New.
	* jit.dg/test-calling-external-function.c: New.
	* jit.dg/test-calling-function-ptr.c: New.
	* jit.dg/test-combination.c: New.
	* jit.dg/test-dot-product.c: New.
	* jit.dg/test-empty.c: New.
	* jit.dg/test-error-accessing-field-in-other-struct.c: New.
	* jit.dg/test-error-adding-to-terminated-block.c: New.
	* jit.dg/test-error-array-as-pointer.c: New.
	* jit.dg/test-error-bad-cast.c: New.
	* jit.dg/test-error-block-in-wrong-function.c: New.
	* jit.dg/test-error-call-through-ptr-with-mismatching-args.c: New.
	* jit.dg/test-error-call-through-ptr-with-non-function.c: New.
	* jit.dg/test-error-call-through-ptr-with-non-pointer.c: New.
	* jit.dg/test-error-call-through-ptr-with-not-enough-args.c: New.
	* jit.dg/test-error-call-through-ptr-with-too-many-args.c: New.
	* jit.dg/test-error-call-with-mismatching-args.c: New.
	* jit.dg/test-error-call-with-not-enough-args.c: New.
	* jit.dg/test-error-call-with-too-many-args.c: New.
	* jit.dg/test-error-dereference-field-of-non-pointer.c: New.
	* jit.dg/test-error-dereference-read-of-non-pointer.c: New.
	* jit.dg/test-error-get-type-bad-enum.c: New.
	* jit.dg/test-error-index-not-a-numeric-type.c: New.
	* jit.dg/test-error-mismatching-types-in-assignment.c: New.
	* jit.dg/test-error-mismatching-types-in-call.c: New.
	* jit.dg/test-error-missing-return.c: New.
	* jit.dg/test-error-new-binary-op-bad-op.c: New.
	* jit.dg/test-error-new-function-bad-kind.c: New.
	* jit.dg/test-error-new-unary-op-bad-op.c: New.
	* jit.dg/test-error-null-passed-to-api.c: New.
	* jit.dg/test-error-return-within-void-function.c: New.
	* jit.dg/test-error-unreachable-block.c: New.
	* jit.dg/test-error-unterminated-block.c: New.
	* jit.dg/test-error-value-not-a-numeric-type.c: New.
	* jit.dg/test-expressions.c: New.
	* jit.dg/test-factorial.c: New.
	* jit.dg/test-fibonacci.c: New.
	* jit.dg/test-functions.c: New.
	* jit.dg/test-fuzzer.c: New.
	* jit.dg/test-hello-world.c: New.
	* jit.dg/test-linked-list.c: New.
	* jit.dg/test-long-names.c: New.
	* jit.dg/test-nested-contexts.c: New.
	* jit.dg/test-nested-loops.c: New.
	* jit.dg/test-operator-overloading.cc: New.
	* jit.dg/test-quadratic.c: New.
	* jit.dg/test-quadratic.cc: New.
	* jit.dg/test-reading-struct.c: New.
	* jit.dg/test-string-literal.c: New.
	* jit.dg/test-sum-of-squares.c: New.
	* jit.dg/test-threads.c: New.
	* jit.dg/test-types.c: New.
	* jit.dg/test-using-global.c: New.
	* jit.dg/test-volatile.c: New.

include/ChangeLog:
	* ChangeLog.jit: New.

libbacktrace/ChangeLog:
	* ChangeLog.jit: New.

libcpp/ChangeLog:
	* ChangeLog.jit: New.

libdecnumber/ChangeLog:
	* ChangeLog.jit: New.

libiberty/ChangeLog:
	* ChangeLog.jit: New.

zlib/ChangeLog:
	* ChangeLog.jit: New.

From-SVN: r217374
2014-11-11 21:55:52 +00:00
Manuel López-Ibáñez 10a241382b Revert revision 217149 because it breaks Ada:
gcc/testsuite/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * gcc.misc-tests/output.exp: New test case for identical input and
        output files.

include/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * diagnostic-core.h: Add prototype for fatal_error.
        * diagnostic.c (fatal_error): New function fatal_error.
        * gcc.c (store_arg): Remove have_o_argbuf_index.
        (process_command): Check if input and output files are the same.
        * toplev.c (init_asm_output): Check if input and output files are
        the same.

libiberty/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * filename_cmp.c (canonical_filename_eq): New function to check if
        file names are the same.
        * functions.texi: Updated with documentation for new function.

From-SVN: r217159
2014-11-05 22:17:22 +00:00
Anthony Brandon 9c7a77fcc3 re PR driver/36312 (should refuse to overwrite input file with output file)
gcc/testsuite/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* gcc.misc-tests/output.exp: New test case for identical input and
	output files.

include/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* diagnostic-core.h: Add prototype for fatal_error.
	* diagnostic.c (fatal_error): New function fatal_error.
	* gcc.c (store_arg): Remove have_o_argbuf_index.
	(process_command): Check if input and output files are the same.
	* toplev.c (init_asm_output): Check if input and output files are
	the same.

libiberty/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* filename_cmp.c (canonical_filename_eq): New function to check if
	file names are the same.
	* functions.texi: Updated with documentation for new function.

From-SVN: r217149
2014-11-05 17:23:46 +00:00
Rainer Orth 8c7686294e Fix gnu11 fallout on Solaris 10+
libobjc:
	* thr.c (_XOPEN_SOURCE): Define as 600.

	libiberty:
	* sigsetmask.c (_POSIX_SOURCE): Remove.

	libgomp:
	* config/posix/lock.c (_XOPEN_SOURCE) Define as 600.

From-SVN: r217117
2014-11-05 09:52:42 +00:00
Yury Gribov ea41822adf Add strtoll and strtoull to libiberty.
2014-10-28  Yury Gribov  <y.gribov@samsung.com>

include/
	* libiberty.h (strtol, strtoul, strtoll, strtoull): New prototypes.

libiberty/
	* strtoll.c: New file.
	* strtoull.c: New file.
	* configure.ac: Add long long checks.  Add harness for strtoll and
	strtoull.  Check decls for strtol, strtoul, strtoll, strtoull.
	* Makefile.in (CFILES, CONFIGURED_OFILES): Add strtoll and strtoull.
	* config.in: Regenerate.
	* configure: Regenerate.
	* functions.texi: Regenerate.
	* testsuite/Makefile.in (check-strtol): New rule.
	(test-strtol): Likewise.
	(mostlyclean): Clean up strtol test.
	* testsuite/test-strtol.c: New test.

From-SVN: r216772
2014-10-28 09:43:20 +00:00
David Malcolm e39423c06d libiberty: Expose choose_tmpdir, and fix constness of return type
include/ChangeLog:
	* libiberty.h (choose_tmpdir): New prototype.

libiberty/ChangeLog:
	* choose-temp.c (choose_tmpdir): Remove now-redundant local
	copy of prototype.
	* functions.texi: Regenerate.
	* make-temp-file.c (choose_tmpdir): Convert return type from
	char * to const char * - given that this returns a pointer to
	a memoized allocation, the caller must not touch it.

From-SVN: r216285
2014-10-15 20:20:05 +00:00
Joel Brobecker 2a523cfe4e Use strtod instead of strtold in libiberty/d-demangle.c
strtold is currently used to decode templates which have a floating-point
value encoded inside; but this routine is not available on some systems,
such as Solaris 2.9 for instance.

This patch fixes the issue by replace the use of strtold by strtod.
It reduces a bit the precision, but it should still remain acceptable
in most cases.

libiberty/ChangeLog:

        * d-demangle.c: Replace strtold with strtod in global comment.
        (strtold): Remove declaration.
        (strtod): New declaration.
        (dlang_parse_real): Declare value as double instead of long
        double.  Replace call to strtold by call to strtod.
        Update format in call to snprintf.

From-SVN: r216216
2014-10-14 17:57:08 +00:00
Jason Merrill 00eaaa5056 mangle.c (is_std_substitution): Check for abi_tag.
gcc/cp/
	* mangle.c (is_std_substitution): Check for abi_tag.
libiberty/
	* cp-demangle.c (d_substitution): Handle abi tags on abbreviation.

From-SVN: r215647
2014-09-26 15:57:37 -04:00
Max Ostapenko 29ce50b031 pex-common.h (struct pex_funcs): Add new parameter for open_write field.
libiberty/

2014-09-26  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* pex-common.h (struct pex_funcs): Add new parameter for open_write field.
	* pex-unix.c (pex_unix_open_write): Add support for new parameter.
	* pex-djgpp.c (pex_djgpp_open_write): Likewise.
	* pex-win32.c (pex_win32_open_write): Likewise.
	* pex-common.c (pex_run_in_environment): Likewise.


include/

2014-09-26  Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* libiberty.h (PEX_STDOUT_APPEND): New flag.
	(PEX_STDERR_APPEND): Likewise.

From-SVN: r215632
2014-09-26 10:58:04 +03:00
Iain Buclaw 43b1b9edfc demangle.h (DMGL_DLANG): New macro.
include/:
	* demangle.h (DMGL_DLANG): New macro.
	(DMGL_STYLE_MASK): Add DMGL_DLANG.
	(demangling_styles): Add dlang_demangling.
	(DLANG_DEMANGLING_STYLE_STRING): New macro.
	(DLANG_DEMANGLING): New macro.
	(dlang_demangle): New prototype.
libiberty/:
	* Makefile.in (CFILES): Add d-demangle.c.
	(REQUIRED_OFILES): Add d-demangle.o.
	* cplus-dem.c (libiberty_demanglers): Add dlang_demangling case.
	(cplus_demangle): Likewise.
	* d-demangle.c: New file.
	* testsuite/Makefile.in (really-check): Add check-d-demangle.
	* testsuite/d-demangle-expected: New file.

From-SVN: r215530
2014-09-23 18:36:14 +00:00
Ian Lance Taylor 0f1fbc836e simple-object-elf.c (simple_object_elf_write_ehdr): Correctly handle objects with more than SHN_LORESERVE sections.
* simple-object-elf.c (simple_object_elf_write_ehdr): Correctly
	handle objects with more than SHN_LORESERVE sections.
	(simple_object_elf_write_shdr): Add sh_link parameter.
	(simple_object_elf_write_to_file): Correctly handle objects with
	more than SHN_LORESERVE sections.

From-SVN: r215394
2014-09-19 15:24:56 +00:00
Andrew Burgess 606f9e78c6 cp-demangle.c (d_dump): Only access field from s_fixed part of the union for DEMANGLE_COMPONENT_FIXED_TYPE.
* cp-demangle.c (d_dump): Only access field from s_fixed part of
	the union for DEMANGLE_COMPONENT_FIXED_TYPE.
	(d_count_templates_scopes): Likewise.

From-SVN: r214740
2014-08-29 15:30:10 -04:00
Gary Benson 635f48009c demangler-fuzzer.c: New file.
libiberty/
	* testsuite/demangler-fuzzer.c: New file.
	* testsuite/Makefile.in (fuzz-demangler): New rule.
	(demangler-fuzzer): Likewise.
	(mostlyclean): Clean up demangler fuzzer.

From-SVN: r213912
2014-08-13 15:56:38 +00:00
Andrew Burgess ac8345a525 Delete temporary string within demangler even in failure cases.
A call to demangle_template might allocate storage within a temporary
string even if the call to demangle_template eventually returns
failure.

This will never cause the demangler to crash, but does leak memory, as
a result I've not added any tests for this.

Calling string_delete is safe, even if nothing is allocated into the
string, the string is initialised with string_init, so we know the
internal pointers are NULL.

libiberty/ChangeLog

	* cplus-dem.c (do_type): Call string_delete even if the call to
	demangle_template fails.

From-SVN: r211449
2014-06-11 10:57:27 +00:00
Ray Donnelly ad484eca9f pex-win32.c (argv_to_cmdline): Don't quote args unnecessarily
2014-06-01  Ray Donnelly  <mingw.android@gmail.com>

        * pex-win32.c (argv_to_cmdline): Don't quote
        args unnecessarily

From-SVN: r211116
2014-06-01 21:09:59 +02:00
Pedro Alves bc2eed9a8e Fix demangler testsuite crashes with CP_DEMANGLE_DEBUG defined
Running the demangler's testsuite with CP_DEMANGLE_DEBUG defined
crashes, with:

 Program received signal SIGSEGV, Segmentation fault.
 0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
 567       switch (dc->type)

 (gdb) bt 3
 #0  0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
 #1  0x000000000040ae47 in d_dump (dc=0x7fffffffd098, indent=10) at ../../src/libiberty/cp-demangle.c:787
 #2  0x000000000040ae47 in d_dump (dc=0x7fffffffd0c8, indent=8) at ../../src/libiberty/cp-demangle.c:787

Note dc=0x1, which is obviously a bogus pointer.  This is the end of
d_dump recursing for a component type that that doesn't actually have
subtrees:

 787       d_dump (d_left (dc), indent + 2);
 788       d_dump (d_right (dc), indent + 2);

This fixes the two cases the testsuite currently trips on.

libiberty/
2014-05-28  Pedro Alves  <palves@redhat.com>

	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM
	and DEMANGLE_COMPONENT_NUMBER.

From-SVN: r211035
2014-05-28 21:55:41 +00:00
Thomas Schwinge 6aa9ea7f4c Fix test in libiberty/testsuite/demangle-expected.
libiberty/
	* testsuite/demangle-expected: Fix last commit.

From-SVN: r210803
2014-05-22 13:56:45 +02:00
Andrew Burgess 70c8c2b932 cplus-dmem.c (internal_cplus_demangle): Free any resources allocated by possible previous call to gnu_special.
libiberty/
2014-05-14  Andrew Burgess  <aburgess@broadcom.com>

	* cplus-dmem.c (internal_cplus_demangle): Free any resources
	allocated by possible previous call to gnu_special.
	(squangle_mop_up): Reset pointers to NULL after calling free.
	* testsuite/demangle-expected: New test case.

From-SVN: r210425
2014-05-14 14:18:49 +00:00
Gary Benson 861c349582 cp-demangle.c (struct d_component_stack): New structure.
libiberty/
2014-05-08  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_component_stack): New structure.
	(struct d_print_info): New field component_stack.
	(d_print_init): Initialize the above.
	(d_print_comp_inner): Renamed from d_print_comp.
	Do not restore template stack if it would cause a loop.
	(d_print_comp): New function.
	* testsuite/demangle-expected: New test cases.

From-SVN: r210205
2014-05-08 09:13:44 +00:00
Jakub Jelinek 4f148bbc73 re PR sanitizer/56781 (boostrap-asan failure: fixincl fails to link (missing -lasan))
PR sanitizer/56781
lto-plugin/
	* Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize=address.
	(liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS,
	liblto_plugin_la_DEPENDENCIES): Prefer ../libiberty/noasan/libiberty.a
	over ../libiberty/pic/libiberty.a if the former exists.
	* Makefile.in: Regenerated.
libiberty/
	* maint-tool: Also emit rule for noasan/ subdirectory.
	* configure.ac (NOASANFLAG): Set and substitute.
	* Makefile.in: Regenerated.
	(NOASANFLAG): Set.
	(all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic
	subdir.
	(stamp-noasandir): New goal.
	* configure: Regenerated.

From-SVN: r209476
2014-04-17 14:25:25 +02:00
Richard Biener 25336bb650 simple-object.c (simple_object_internal_write): Handle EINTR and short writes.
2014-04-01  Richard Biener  <rguenther@suse.de>

	libiberty/
	* simple-object.c (simple_object_internal_write): Handle
	EINTR and short writes.

From-SVN: r208972
2014-04-01 07:45:48 +00:00
Richard Biener 2486c24a8c simple-object.c (simple_object_internal_read): Handle EINTR and short reads.
2014-03-28  Richard Biener  <rguenther@suse.de>

	libiberty/
	* simple-object.c (simple_object_internal_read): Handle
	EINTR and short reads.

	lto-plugin/
	* lto-plugin.c (process_symtab): Handle EINTR and short reads.

From-SVN: r208898
2014-03-28 14:05:49 +00:00
Uros Bizjak 52684bb3c8 regex.c (bzero): Define without coma expression.
* regex.c (bzero) [!_LIBC]: Define without coma expression.
	(regerror): Cast the call to memcpy to (void) to avoid unused
	value warnings.

From-SVN: r208553
2014-03-13 19:34:47 +01:00
Thomas Schwinge e191f50260 Avoid "'dc' may be uninitialized" warning.
libiberty/
	* cp-demangle.c (d_demangle_callback): Put an abort call in place,
	to help the compiler.

From-SVN: r207200
2014-01-28 20:06:44 +01:00
Tom Tromey d2d21de9dc include
* ansidecl.h (ANSI_PROTOTYPES, PTRCONST, LONG_DOUBLE, PARAMS)
	(VPARAMS, VA_START, VA_OPEN, VA_CLOSE, VA_FIXEDARG, CONST)
	(VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, AND, DOTS)
	(NOARGS): Don't define.
	* libiberty.h (expandargv, writeargv): Don't use PARAMS.
libiberty
	* _doprint.c (checkit): Use stdarg, not VA_* macros.
	* asprintf.c (asprintf): Use stdarg, not VA_* macros.
	* concat.c (concat_length, concat_copy, concat_copy2, concat)
	(reconcat): Use stdarg, not VA_* macros.
	* snprintf.c (snprintf): Use stdarg, not VA_* macros.
	* vasprintf.c (checkit): Use stdarg, not VA_* macros.
	* vsnprintf.c (checkit): Use stdarg, not VA_* macros.

From-SVN: r206881
2014-01-21 15:09:10 +00:00
Mike Frysinger 0225cc0f1f libiberty: fix --enable-install-libiberty flag [PR 56780]
Commit 199570 fixed the --disable-install-libiberty behavior, but it also
added a bug where the enable path never works because the initial clear
of target_header_dir wasn't deleted.  So we end up initializing properly
at the top only to reset it at the end all the time.

From-SVN: r206367
2014-01-06 18:15:31 +00:00
Gary Benson 0a15a50e83 cp-demangle.c (struct d_print_info): New fields next_saved_scope...
libiberty/
2014-01-06  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_print_info): New fields
	next_saved_scope, copy_templates, next_copy_template and
	num_copy_templates.
	(d_count_templates): New function.
	(d_print_init): New parameter "dc".
	Estimate numbers of templates and scopes required.
	(d_print_free): Removed function.
	(cplus_demangle_print_callback): Allocate stack for
	templates and scopes.  Removed call to d_print_free.
	(d_copy_templates): Removed function.
	(d_save_scope): New function.
	(d_get_saved_scope): Likewise.
	(d_print_comp): Replace state saving/restoring code with
	calls to d_save_scope and d_get_saved_scope.

From-SVN: r206362
2014-01-06 14:14:21 +00:00
Jason Merrill 1f26ac8748 re PR c++/41090 (Using static label reference in c++ class constructor produces wrong code)
PR c++/41090
	Add -fdeclone-ctor-dtor.
gcc/cp/
	* optimize.c (can_alias_cdtor, populate_clone_array): Split out
	from maybe_clone_body.
	(maybe_thunk_body): New function.
	(maybe_clone_body): Call it.
	* mangle.c (write_mangled_name): Remove code to suppress
	writing of mangled name for cloned constructor or destructor.
	(write_special_name_constructor): Handle decloned constructor.
	(write_special_name_destructor): Handle decloned destructor.
	* method.c (trivial_fn_p): Handle decloning.
	* semantics.c (expand_or_defer_fn_1): Clone after setting linkage.
gcc/c-family/
	* c.opt: Add -fdeclone-ctor-dtor.
	* c-opts.c (c_common_post_options): Default to on iff -Os.
gcc/
	* cgraph.h (struct cgraph_node): Add calls_comdat_local.
	(symtab_comdat_local_p, symtab_in_same_comdat_p): New.
	* cif-code.def: Add USES_COMDAT_LOCAL.
	* symtab.c (verify_symtab_base): Make sure we don't refer to a
	comdat-local symbol from outside its comdat.
	* cgraph.c (verify_cgraph_node): Likewise.
	* cgraphunit.c (mark_functions_to_output): Don't mark comdat-locals.
	* ipa.c (symtab_remove_unreachable_nodes): Likewise.
	(function_and_variable_visibility): Handle comdat-local fns.
	* ipa-cp.c (determine_versionability): Don't clone comdat-locals.
	* ipa-inline-analysis.c (compute_inline_parameters): Update
	calls_comdat_local.
	* ipa-inline-transform.c (inline_call): Likewise.
	(save_inline_function_body): Don't clear DECL_COMDAT_GROUP.
	* ipa-inline.c (can_inline_edge_p): Check calls_comdat_local.
	* lto-cgraph.c (input_overwrite_node): Read calls_comdat_local.
	(lto_output_node): Write it.
	* symtab.c (symtab_dissolve_same_comdat_group_list): Clear
	DECL_COMDAT_GROUP for comdat-locals.
include/
	* demangle.h (enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_ctor.
	(enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_dtor.
libiberty/
	* cp-demangle.c (cplus_demangle_fill_ctor,cplus_demangle_fill_dtor):
	Handle unified ctor/dtor.
	(d_ctor_dtor_name): Handle unified ctor/dtor.

From-SVN: r206182
2013-12-23 12:49:47 -05:00
Cary Coutant 85d09f6173 Fix demangler to handle conversion operators correctly.
libiberty/
	PR other/59195
	* cp-demangle.c (struct d_info_checkpoint): New struct.
	(struct d_print_info): Add current_template field.
	(d_operator_name): Set flag when processing a conversion
	operator.
	(cplus_demangle_type): When processing <template-args> for
	a conversion operator, backtrack if necessary.
	(d_expression_1): Renamed from d_expression.
	(d_expression): New wrapper around d_expression_1.
	(d_checkpoint): New function.
	(d_backtrack): New function.
	(d_print_init): Initialize current_template.
	(d_print_comp): Set current_template.
	(d_print_cast): Put current_template in scope for
	printing conversion operator name.
	(cplus_demangle_init_info): Initialize is_expression and
	is_conversion.
	* cp-demangle.h (struct d_info): Add is_expression and
	is_conversion fields.
	* testsuite/demangle-expected: New test cases.

From-SVN: r205292
2013-11-22 14:25:49 -08:00
Andreas Schwab 66204992cb picflag.m4 (m68k-*-*): Use default PIC flag.
config/
* picflag.m4 (m68k-*-*): Use default PIC flag.

gcc/
* configure: Regenerate.

libada/
* configure: Regenerate.

libgcc/
* configure: Regenerate.

libiberty/
* configure: Regenerate.

From-SVN: r204854
2013-11-15 17:49:36 +00:00
Uros Bizjak 27297d2d1b cp-demangle.c (d_copy_templates): Cast result of malloc to (struct d_print_template *).
* cp-demangle.c (d_copy_templates): Cast result of malloc
	to (struct d_print_template *).
	(d_print_comp): Cast result of realloc to (struct d_saved scope *).

From-SVN: r204713
2013-11-12 21:02:21 +01:00
Marc Glisse eda14d6a85 re PR tree-optimization/58689 ([meta-bug] __attribute__((returns_nonnull)) enhancements)
2013-10-29  Marc Glisse  <marc.glisse@inria.fr>

	PR tree-optimization/58689
include/
	* ansidecl.h (ATTRIBUTE_RETURNS_NONNULL): New macro.
	* libiberty.h (basename, lbasename, dos_lbasename, unix_lbasename,
	concat_copy): Mark with attributes nonnull(1) and returns_nonnull.
	(concat, reconcat, concat_copy2, choose_temp_base, xstrerror,
	xmalloc, xrealloc, xcalloc, xstrdup, xstrndup, xmemdup, pex_init):
	Mark with attribute returns_nonnull.

libiberty/
	* concat.c: Remove note about xmalloc.

From-SVN: r204159
2013-10-29 13:15:48 +00:00
Gerald Pfeifer 4962e51350 * testsuite/test-demangle.c: Include unistd.h.
From-SVN: r204107
2013-10-27 18:35:20 +00:00
Gary Benson c24d86bcb2 cp-demangle.c (struct d_saved_scope): New structure.
libiberty/
2013-10-25  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_saved_scope): New structure.
	(struct d_print_info): New fields saved_scopes and
	num_saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(d_copy_templates): New function.
	(d_print_comp): New variables saved_templates and
	need_template_restore.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.
	* testsuite/demangle-expected: Add regression test.

From-SVN: r204068
2013-10-25 13:56:51 +00:00
Gerald Pfeifer 89ac07979f * testsuite/test-expandargv.c: Include unistd.h.
From-SVN: r203993
2013-10-23 21:31:45 +00:00
Gerald Pfeifer ecdbd01aa1 Fix up ChangeLog entries (name, e-mail, formatting, otherwise).
From-SVN: r203992
2013-10-23 21:30:54 +00:00
David Malcolm 459260ecf8 Add --enable-host-shared configuration option
/
	* configure.ac: Add --enable-host-shared
	* configure: Regenerate.

gcc/
	* Makefile.in (PICFLAG): New.
	(enable_host_shared): New.
	(INTERNAL_CFLAGS): Use PICFLAG.
	(LIBIBERTY): Use pic build of libiberty.a if configured with
	--enable-host-shared.
	* configure.ac: Add --enable-host-shared, setting up new
	PICFLAG variable.
	* configure: Regenerate.
	* doc/install.texi (--enable-shared): Add note contrasting it
	with...
	(--enable-host-shared): New option.

libbacktrace/
	* configure.ac: Add --enable-host-shared, setting up
	pre-existing PIC_FLAG variable within Makefile.am et al.
	* configure: Regenerate.

libcpp/
	* Makefile.in (PICFLAG): New.
	(ALL_CFLAGS): Add PICFLAG.
	(ALL_CXXFLAGS): Likewise.
	* configure.ac: Add --enable-host-shared, setting up new
	PICFLAG variable.
	* configure: Regenerate.

libdecnumber/
	* Makefile.in (PICFLAG): New.
	(ALL_CFLAGS): Add PICFLAG.
	* configure.ac: Add --enable-host-shared, setting up new
	PICFLAG variable.
	* configure: Regenerate.

libiberty/
	* configure.ac: If --enable-host-shared, use -fPIC.
	* configure: Regenerate.

zlib/
	* configure.ac: Add --enable-host-shared, setting up new
	PICFLAG variable.
	* Makefile.am: Add PICFLAG to libz_a_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

From-SVN: r203632
2013-10-15 20:33:55 +00:00
Paul Pluzhnikov ea0882a0ab cp-demangle.c (d_name): Demangle local-source-names.
2013-10-11  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* cp-demangle.c (d_name): Demangle local-source-names.
	* testsuite/demangle-expected: New test.

From-SVN: r203476
2013-10-11 17:31:18 -07:00
Gary Benson 0e2cd22d3d ChangeLog: Add missing file to two entries.
* libiberty/ChangeLog: Add missing file to two entries.

From-SVN: r202526
2013-09-12 13:27:46 +00:00
Paolo Carlini 8b415b271e re PR bootstrap/58386 (libstdc++.so.6: undefined symbol: htab_hash_pointer)
2013-09-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR bootstrap/58386
	Revert:

	2013-09-10  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c: Include hashtab.h.
	(struct d_print_info): New field saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(struct d_saved_scope): New structure.
	(d_store_scope): New function.
	(d_free_scope) Likewise.
	(d_restore_scope) Likewise.
	(d_hash_saved_scope) Likewise.
	(d_equal_saved_scope) Likewise.
	(d_print_comp): New variable saved_scope.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.

From-SVN: r202480
2013-09-10 18:45:29 +00:00
Gary Benson 669ea36c4a cp-demangle.c: Include hashtab.h.
2013-09-10  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c: Include hashtab.h.
	(struct d_print_info): New field saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(struct d_saved_scope): New structure.
	(d_store_scope): New function.
	(d_free_scope) Likewise.
	(d_restore_scope) Likewise.
	(d_hash_saved_scope) Likewise.
	(d_equal_saved_scope) Likewise.
	(d_print_comp): New variable saved_scope.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.

From-SVN: r202442
2013-09-10 12:33:50 +00:00
Alan Modra a98cbc3694 floatformat.h (floatformat_ibm_long_double): Delete.
include/
	* floatformat.h (floatformat_ibm_long_double): Delete.
	(floatformat_ibm_long_double_big): Declare.
	(floatformat_ibm_long_double_little): Declare.
libiberty/
	* floatformat.c (floatformat_ibm_long_double): Rename to..
	(floatformat_ibm_long_double_big): ..this.
	(floatformat_ibm_long_double_little): New.

From-SVN: r201869
2013-08-20 15:01:41 +09:30
Tristan Gingold 3830d98a8b makefile.vms (OBJS): Add dwarfnames.obj
2013-07-09  Tristan Gingold  <gingold@adacore.com>

	* makefile.vms (OBJS): Add dwarfnames.obj

From-SVN: r200812
2013-07-09 07:43:35 +00:00
Matt Burgess 8c9fddf41d re PR other/56780 (--disable-install-libiberty still installs libiberty.a)
PR other/56780
	* libiberty/configure.ac: Move test for --enable-install-libiberty
	outside of the 'with_target_subdir' test so that it actually gets
	run.  Add output messages to show the test result.
	* libiberty/configure: Regenerate.
	* libiberty/Makefile.in (install_to_libdir): Place the
	installation of the libiberty library in the same guard as that
	used for the headers to prevent it being installed unless
	requested via --enable-install-libiberty.

From-SVN: r199570
2013-06-01 00:20:49 +00:00
David Edelsohn b768e8cf27 hashtab.c (hash_pointer): Remove conditional and avoid unexecuted shift equal to wordsize.
2013-05-06  David Edelsohn  <dje.gcc@gmail.com>
            Peter Bergner  <bergner@vnet.ibm.com>
            Segher Boessenkool  <segher@kernel.crashing.org>
            Jakub Jelinek  <jakub@redhat.com>

        * hashtab.c (hash_pointer): Remove conditional and avoid
        unexecuted shift equal to wordsize.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: Peter Bergner <bergner@vnet.ibm.com>
Co-Authored-By: Segher Boessenkool <segher@kernel.crashing.org>

From-SVN: r198633
2013-05-06 11:40:54 -04:00
Andi Kleen 86210f13cd Improve pointer hash function to include all bits
The hashtab pointer hash function is not very good. It throws most of the
bits in the pointer away.

This changes pointer_hash to use the mix code from jhash function that mixes
all the bits on the pointer and makes them dependent on each other, before doing
the modulo.

libiberty/:

2013-04-22  Andi Kleen <ak@linux.intel.com>

	* hashtab.c (hash_pointer): Move to end of file and reimplement.

From-SVN: r198171
2013-04-23 03:09:47 +00:00
Jason Merrill 0861bec80a cp-demangle.c (cplus_demangle_type): Fix function quals.
libiberty/
	* cp-demangle.c (cplus_demangle_type): Fix function quals.
	(d_pointer_to_member_type): Simplify.
gcc/cp/
	* mangle.c (write_type): When writing a function type with
	function-cv-quals, don't add the unqualified type as a
	substitution candidate.

From-SVN: r197460
2013-04-03 20:14:00 -04:00
Jason Merrill 9eb85f2724 Demangle C++11 ref-qualifier.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_REFERENCE_THIS,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS.
libiberty/
	* cp-demangle.c (d_ref_qualifier): New.
	(d_nested_name, d_function_type): Use it.
	(d_parmlist): Don't get confused by a ref-qualifier.
	(cplus_demangle_type): Reorder ref-qualifier.
	(d_pointer_to_member_type): Likewise.
	(d_dump): Handle DEMANGLE_COMPONENT_REFERENCE_THIS and
	DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS.
	(d_make_comp, has_return_type, d_encoding): Likewise.
	(d_print_comp, d_print_mod_list, d_print_mod): Likewise.
	(d_print_function_type, is_ctor_or_dtor): Likewise.

From-SVN: r197436
2013-04-03 13:24:12 -04:00
Kai Tietz 071928d9dc configure: Regenerated.
* configure: Regenerated.

From-SVN: r197177
2013-03-27 23:00:03 +01:00
Tobias Burnus 34d3a672a8 make-obstacks-texi.pl: New.
contrib/
2013-03-06  Tobias Burnus  <burnus@net-b.de>

        * make-obstacks-texi.pl: New.

libiberty/
2013-03-06  Tobias Burnus  <burnus@net-b.de>

        * libiberty.texi: Update comment, remove lowersections.
        * obstacks.texi: Regenerate.

From-SVN: r196486
2013-03-06 09:38:22 +01:00
Jakub Jelinek 233fa36063 re PR middle-end/56526 (false positive for maybe-uninitialized)
PR middle-end/56526
	* simple-object-mach-o.c (simple_object_mach_o_segment): Initialize
	wrapper_sect_offset to avoid a warning.

From-SVN: r196466
2013-03-05 16:16:49 +01:00
Tobias Burnus 40bf31ed08 extended.texi (C Extensions): Change order in @menu to match @node.
gcc/
2013-03-01  Tobias Burnus  <burnus@net-b.de>

        * doc/extended.texi (C Extensions): Change order in @menu
        to match @node.
        (Other MIPS Built-in Functions): Move last MIPS entry before
        "picoChip Built-in Functions".
        (SH Built-in Functions): Move after RX Built-in Functions.
        * doc/gcc.texi (Introduction): Change order in @menu
        to match @node.
        * doc/md.texi (Constraints): Ditto.
        * gty.texi (Type Information): Ditto.
        (User-provided marking routines for template types): Make
        subsection.
        * doc/invoke.texi (AArch64 Options): Move before
        "Adapteva Epiphany Options".

libiberty/
2013-03-01  Andreas Schwab  <schwab@linux-m68k.org>

        * obstacks.texi (Obstacks): Trim @node to only contain the
        node name.
        * libiberty.texi (Obstacks): Lower section.

From-SVN: r196388
2013-03-01 20:01:57 +01:00
Jason Merrill 622aac0b88 re PR c++/55223 ([C++11] Default lambda expression of a templated class member)
PR c++/55223
gcc/cp/
	* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Fix handling of
	default argument scope.
	* mangle.c (write_name): Likewise.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DEFAULT_ARG.
	(d_print_comp): Likewise.

From-SVN: r196065
2013-02-14 20:26:44 -05:00
Jakub Jelinek 4ab7747c26 re PR other/56245 (-fsanitize=address miscompiles GCC)
PR other/56245
	* regex.c (PTR_INT_TYPE): Define.
	(EXTEND_BUFFER): Change incr type from int to PTR_INT_TYPE.

From-SVN: r195918
2013-02-09 19:41:00 +01:00
Kai Tietz b713829735 Correct ChangeLog's mentioned PR-number.
From-SVN: r195607
2013-01-31 09:31:16 +01:00
Kai Tietz 4cfc6e54ba re PR other/54620 (sha1.c has incorrect math if sizeof(size_t) is 8)
PR other/54620
	* sha1.c (sha1_process_block):  Handle case that size_t is
	a wider-integer-scalar as a 32-bit unsigned integer.

From-SVN: r195603
2013-01-31 09:17:37 +01:00
Kai Tietz b1a2e8c606 2013-01-31 Kai Tietz <ktietz@redhat.com>
PR other/543413
	* md5.c (md5_process_block):  Handle case that size_t is
	a wider-integer-scalar a 32-bit unsigned integer.

From-SVN: r195600
2013-01-31 09:11:43 +01:00
Ian Lance Taylor ad8c59a1b9 re PR other/54800 (libiberty/simple-object-mach-o.c:704: possible optimisation ?)
PR other/54800
	* simple-object-mach-o.c (simple_object_mach_o_segment): Don't
	bother to zero out a buffer we are about to set anyhow.

From-SVN: r194914
2013-01-04 19:00:06 +00:00
David Edelsohn a9b01f002f simple-object-xcoff.c: New file.
* simple-object-xcoff.c: New file.
        * Makefile.in: Add it to build machinery.
        * simple-object-common.h (simple_object_xcoff_functions): Declare.
        * simple-object.c (format_functions): Add
        simple_object_xcoff_functions.

From-SVN: r194774
2013-01-01 21:04:42 -05:00
Jason Merrill c61e8502c1 cp-demangle.c (d_unqualified_name): Handle abi tags here.
* cp-demangle.c (d_unqualified_name): Handle abi tags here.
	(d_name): Not here.

From-SVN: r193401
2012-11-10 21:11:15 -05:00
Jason Merrill 7dbb85a793 Add C++ attribute abi_tag and -Wabi-tag option.
gcc/
	* attribs.c (lookup_attribute_spec): Handle getting a TREE_LIST.
gcc/c-family/
	* c.opt (Wabi-tag): New.
gcc/cp/
	* tree.c (cxx_attribute_table): Add abi_tag attribute.
	(check_abi_tag_redeclaration, handle_abi_tag_attribute): New.
	* class.c (find_abi_tags_r, check_abi_tags): New.
	(check_bases, check_field_decl): Call check_abi_tags.
	* decl.c (redeclaration_error_message): Call
	check_abi_tag_redeclaration.
	* mangle.c (tree_string_cmp, write_abi_tags): New.
	(write_unqualified_name): Call write_abi_tags.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_TAGGED_NAME.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME.
	(d_make_comp, d_find_pack, d_print_comp): Likewise.
	(d_abi_tags): New.
	(d_name): Call it.

From-SVN: r193367
2012-11-09 11:14:37 -05:00