[PATCH 07/16] fold-const.c: add selftests

2016-06-02 Thread David Malcolm
Jeff approved an older version of this (as a separate unittests/test-folding.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03305.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files > is pre-approved. gcc/ChangeLog:

[PATCH 06/16] et-forest.c: add selftests

2016-06-02 Thread David Malcolm
Jeff approved an earlier version of this: https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03295.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files > is pre-approved. This version has been updated to the new style. gcc/Ch

[PATCH 11/16] Add hash-set-tests.c

2016-06-02 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-hash-set.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03300.html > OK if/when prereqs are approved. Minor twiddling if we end up > moving it elsewhere or standardizing/reducing header files is > pre-approved. This version moves the

[PATCH] Selftest framework (v7)

2016-06-03 Thread David Malcolm
On Fri, 2016-06-03 at 01:21 +0200, Bernd Schmidt wrote: > On 06/02/2016 11:06 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * Makefile.in (OBJS): Add function-tests.o, > > hash-map-tests.o, hash-set-tests.o, rtl-tests.o, > > selftest-run-tests.o. &g

Re: [PATCH] Selftest framework (v7)

2016-06-06 Thread David Malcolm
On Sun, 2016-06-05 at 13:37 +0200, Bernd Schmidt wrote: > On 06/03/2016 09:12 PM, David Malcolm wrote: > > It's not clear to me if these approvals still hold. > > I was willing to go with it; I had a look through some of these > patches > and didn't spot anything u

[Committed] Selftest framework (v8)

2016-06-06 Thread David Malcolm
On Mon, 2016-06-06 at 16:40 +0200, Bernd Schmidt wrote: > On 06/06/2016 04:17 PM, David Malcolm wrote: > > I'm testing a revised patch now, incorporating the above, and > > renaming > > s-selftests (plural) to s-selftest (singular) etc within > > gcc/Makefile.in as

Re: [Diagnostic Patch] Clean-up diagnostic facilities in diagnostic.c

2016-06-06 Thread David Malcolm
On Mon, 2016-06-06 at 10:55 +0200, Paolo Carlini wrote: > Hi, > > yesterday I had the idea of this small clean-up: move the work done > by > emit_diagnostic to a new non-variadic diagnostic_impl and use it to > implement the former and all the various inform, warning, permerror, > etc > (lately

[PATCH] spellcheck.c: add test_find_closest_string

2016-06-06 Thread David Malcolm
This adds another test case to -fself-test. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: * spellcheck.c (selftest::test_find_closest_string): New function. (spellcheck_c_tests): Call the above. --- gcc/spellcheck.c | 23 +

[PATCH] Add selftest for pretty-print.c

2016-06-06 Thread David Malcolm
This adds another set of test cases to -fself-test, this time for the basic functionality within pretty-print.c. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: * pretty-print.c: Include "selftest.h". (pp_format): Fix comment. (selft

[PATCH] Add ggc-tests.c

2016-06-06 Thread David Malcolm
Jeff approved an earlier version of this (as unittests/test-ggc.c): https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03306.html > Not terribly happy with that counter to used to create a big list > to detect recursion. But I'm not offhand sure how to avoid without > exposing more of the ggc system t

Re: [PATCH] Selftest framework (v7)

2016-06-07 Thread David Malcolm
On Mon, 2016-06-06 at 22:14 -0400, Trevor Saunders wrote: > On Mon, Jun 06, 2016 at 11:57:49PM +0200, Jakub Jelinek wrote: > > On Mon, Jun 06, 2016 at 05:53:50PM -0400, Trevor Saunders wrote: > > > > > As far as I can > > > > > tell this just involves moving the start of namespace > > > > > selfte

Re: JIT patch: add gcc_jit_magic_int

2016-06-07 Thread David Malcolm
On Mon, 2016-05-23 at 14:26 +0200, Basile Starynkevitch wrote: > Hello All, > > As I explained in https://gcc.gnu.org/ml/jit/2016-q2/msg00042.html it > is > difficult (or tricky without using dirty tricks involving the GCC > plugin > headers) to use GCCJIT to emit code equivalent to the followin

[PATCH] Add selftest for pretty-print.c (v2)

2016-06-07 Thread David Malcolm
On Tue, 2016-06-07 at 12:02 +0200, Bernd Schmidt wrote: > On 06/06/2016 11:28 PM, David Malcolm wrote: > > + assert_pp_format ("0xcafebabe", "%wx", > > (HOST_WIDE_INT)0xcafebabe); > > More interesting tests would be to have multiple arguments to test &

[PATCH] PR bootstrap/71471: remove selftest for pp_format (%p)

2016-06-09 Thread David Malcolm
I was confused by the comment to pp_format: /* The following format specifiers are recognized as being client independent: ... %p: pointer ... */ into thinking that %p is printed in a host-independent manner, when "client independent" means in relation to different pretty-printer

Re: [PATCH] Add selftest for pretty-print.c (v2)

2016-06-09 Thread David Malcolm
On Thu, 2016-06-09 at 11:22 -0600, Jeff Law wrote: > On 06/09/2016 07:30 AM, David Edelsohn wrote: > > > > The self-tests specifically abort the build and break bootstrap > > upon > > failure. Most other changes that inadvertently have bugs or tickle > > a > > latent issue in a target will introd

[PATCH 0/3] selftest improvements

2016-06-09 Thread David Malcolm
not to be the cause of the PR. I've tested the combination of these patches: * successful bootstrap®rtest on x86_64-pc-linux-gnu * successful build/-fselftest of stage 1 on powerpc-ibm-aix7.1.3.0 OK for trunk? David Malcolm (3): selftest: show values when ASSERT_STREQ fails selftests:

[PATCH 1/3] selftest: show values when ASSERT_STREQ fails

2016-06-09 Thread David Malcolm
Rework ASSERT_STREQ so that it prints the actual and expected values to stderr when it fails (by moving it to a helper function). gcc/ChangeLog: * selftest.c (selftest::fail_formatted): New function. (selftest::assert_streq): New function. * selftest.h (selftests::fail_form

[PATCH 2/3] selftests: improve reported failure locations

2016-06-09 Thread David Malcolm
This patch introduce a selftest::location struct to wrap up __FILE__ and __LINE__ information (and __FUNCTION__) throughout the selftests, allowing location information to be passed around. It updates the helper functions in pretty-print.c to pass through the precise location of each test, so that

[PATCH 3/3] pretty-print.c: skip color selftests if GCC_COLORS is set

2016-06-09 Thread David Malcolm
gcc/ChangeLog: * pretty-print.c (assert_pp_format_colored): Skip the test if GCC_COLORS is set. (test_pp_format): Remove comment about GCC_COLORS. --- gcc/pretty-print.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/pretty-print.c b/gcc/prett

[PATCH] PR bootstrap/71481: fix input.c selftest

2016-06-09 Thread David Malcolm
input.c's selftest::test_reading_source_line attempted to read from __FILE__, which doesn't work if the binary is run from a different location than the build dir. Fix it by rewriting the test to write out a tempfile, and read from that, rather than from __FILE__. I used make_temp_file to create

[PATCH] C: fixits for misspelled named initializers

2016-06-10 Thread David Malcolm
On Mon, 2016-06-06 at 15:17 +, Joseph Myers wrote: > On Tue, 31 May 2016, David Malcolm wrote: > > > Ping: > > https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01834.html > > OK. What about field names in designated initializers (both C99 > -style and > old-s

Re: [PATCH] Add ggc-tests.c

2016-06-13 Thread David Malcolm
On Mon, 2016-06-13 at 13:36 +0200, Ulrich Weigand wrote: > Gerald Pfeifer wrote: > > > The source code of need_finalization_p in ggc.h reads > > > >template > >static inline bool > >need_finalization_p () > >{ > >#if GCC_VERSION >= 4003 > > return !__has_trivial_destructo

Re: [PATCH] Fix bootstrap when user language is not english

2016-06-13 Thread David Malcolm
On Mon, 2016-06-13 at 14:41 +, Bernd Edlinger wrote: > Hi, > > as noted in PR bootstrap/71481, comment#4 currently > the trunk fails to bootstrap if the current language is > not english. A workaround is possible by setting LANG=C, > but OTOH it is rather easy to fix, by translating the strin

[PATCH 1/4] Introduce gcc_rich_location::add_fixit_misspelled_id

2016-06-14 Thread David Malcolm
There's a fair amount of repetition in the code to emit fixits for misspelled identifiers, and I plan to add more such fixits, so this patch moves it to a helper method. Successfully bootstrapped®rtested in combination with the rest of the kit on x86_64-pc-linux-gnu Successful -fself-test of stage

[PATCH 2/4] Add more spellcheck selftests

2016-06-14 Thread David Malcolm
The next patch in the kit reimplements find_closest_string and find_closest_identifier, so it seems prudent to add some more test coverage for these. This patch also adds some more test coverage for levenshtein_distance itself. Successfully bootstrapped®rtested in combination with the rest of the

[PATCH 3/4] spellcheck.h: add best_match template; implement early-reject

2016-06-14 Thread David Malcolm
There's a lot of repetition between find_closest_string and find_closest_identifier, and the next patch adds more, so this patch moves the logic into a new template class "best_match" for locating the closest string from a sequence of candidates. The patch also introduces a pair of early-reject op

[PATCH 4/4] C FE: suggest corrections for misspelled identifiers and type names

2016-06-14 Thread David Malcolm
This patch introduces a new lookup_name_fuzzy function to the C frontend and uses it to provides suggestions for various error messages that may be due to misspellings, and also for the warnings in implicit_decl_warning. This latter part may be controversial. So far, we've only provided spelling

[PATCH] C++ FE: Show both locations in string literal concatenation error

2016-06-17 Thread David Malcolm
We can use rich_location and the new diagnostic_show_locus to print both locations when complaining about a bogus string concatenation in the C++ FE, giving e.g.: test.C:3:24: error: unsupported non-standard concatenation of string literals const void *s = u8"a" u"b"; ~ ^~~

[PATCH] input.c: add lexing selftests and a test matrix for line_table states

2016-06-17 Thread David Malcolm
This patch adds explicit testing of lexing a source file, generalizing this (and the test of ordinary line maps) over a 2-dimensional test matrix covering: (1) line_table->default_range_bits: some frontends use a non-zero value and others use zero (2) the fallback modes within line-map.c: t

Re: [BUILDROBOT] Selftest failed for rs6000-ibm-aix4.3

2016-06-18 Thread David Malcolm
On Sat, 2016-06-18 at 15:06 +0200, Jan-Benedict Glaw wrote: > Hi David, Segher, Aldy! > > Davids new selftest code found something for the rs6000-ibm-aix4.3 > target, maybe you're interested: > > /home/jbglaw/src/toolchain/build/./gcc/xgcc > -B/home/jbglaw/src/toolchain/build/./gcc/ -xc -S -c /d

[PATCH] Implement -fdiagnostics-parseable-fixits

2016-06-21 Thread David Malcolm
Both GCC and Clang can emit "fix-it" hints for a diagnostic, giving a suggestion about how to fix the issue. Clang has an option -fdiagnostics-parseable-fixits, which emits a machine-readable version of the fixits, for use by IDEs. (The only IDE I know of that supports this format is Xcode [1]; d

[committed] libcpp: Tweak to missing #include source location

2016-06-22 Thread David Malcolm
This patch tweaks the error message location for missing header files. Previously these read: test.c:1:17: fatal error: 404.h: No such file or directory #include "404.h" ^ compilation terminated. With this patch, the pertinent string is underlined: test.c:1:10: fatal error: 40

[PATCH] Fix source locations of bad enum values (PR c/71610 and PR c/71613)

2016-06-22 Thread David Malcolm
PR c/71613 identifies a problem where we fail to report this enum: enum { e1 = LLONG_MIN }; with -pedantic, due to LLONG_MIN being inside a system header. This patch updates the C and C++ frontends to use the location of the name as the primary location in the diagnostic, supplying the locatio

Re: [PATCH] Print column numbers in inclusion trace consistently.

2016-06-23 Thread David Malcolm
t; > gcc/ChangeLog: > > > >PR/42014 > > > >* diagnostic.c (diagnostic_report_current_module): Print column > > numbers > > for all mentioned files if context->show_column. > > > > gcc/testsuite/ChangeLog: > > > >PR/

[PATCH] Fix bogus option suggestions for RejectNegative options (PR driver/71651)

2016-06-24 Thread David Malcolm
PR driver/71651 identifies an issue where the driver can make nonsensical suggestions for options flagged as RejectNegative: $ gcc -fno-stack-protector-explicit gcc: error: unrecognized command line option '-fno-stack-protector-explicit'; did you mean '-fno-stack-protector-explicit'? where the

[PATCH] Offer suggestions for misspelled --param names.

2016-06-27 Thread David Malcolm
Another use of spellcheck.{c|h}, this time for --param. Successfully bootstrapped®retested on x86_64-pc-linux-gnu; adds 4 PASS results to gcc.sum. OK for trunk? gcc/ChangeLog: * opts.c (handle_param): Use find_param_fuzzy to offer suggestions for misspelled param names. *

Re: [PATCH 2/9] c-decl.c: add [cd]tors to c_struct_parse_info

2016-06-29 Thread David Malcolm
On Wed, 2016-06-29 at 08:26 -0400, tbsaunde+...@tbsaunde.org wrote: > From: Trevor Saunders > > gcc/c/ChangeLog: I may be missing my coffee here but you mention adding a constructor in the ChangeLog here: > 2016-06-29 Trevor Saunders > > * c-decl.c (struct c_struct_parse_info): Add co

[PATCH] C++: show location of unclosed extern "C" specifications (v2)

2017-10-12 Thread David Malcolm
On Wed, 2017-10-11 at 15:51 -0400, Jason Merrill wrote: > On Tue, Sep 26, 2017 at 3:27 PM, David Malcolm > wrote: > > * cp-tree.h (struct saved_scope): Add "location" field. > > saved_scope seems like the wrong place for this; it's only > interesting

[PATCH] Add gnu::unique_ptr

2017-10-12 Thread David Malcolm
identified by Trevor here: https://gcc.gnu.org/ml/gcc-patches/2017-07/msg02085.html Thanks Dave Blurb from Trevor: For most of the history of this see https://sourceware.org/ml/gdb-patches/2016-10/msg00223.html The changes are mostly s/gdb/gtl/g include/ChangeLog: 2017-07-29 Trevor Saunders

[committed] C++: show location of unclosed extern "C" specifications (v3)

2017-10-13 Thread David Malcolm
On Thu, 2017-10-12 at 17:07 -0400, Jason Merrill wrote: > On Thu, Oct 12, 2017 at 2:45 PM, David Malcolm > wrote: > > - put the note on the string-literal, rather than the extern: > > note: 'extern "C"' linkage started here > > extern "C&q

[PATCH] Implement unique_xmalloc_ptr and add more selftests

2017-10-13 Thread David Malcolm
On Fri, 2017-10-13 at 13:01 +0100, Pedro Alves wrote: > On 10/13/2017 10:26 AM, Richard Biener wrote: > > On Fri, Oct 13, 2017 at 2:40 AM, David Malcolm > > wrote: > > > From: Trevor Saunders > > > > > > I had a go at updating Trevor's unique_ptr

[committed] Add gnu::unique_ptr

2017-10-16 Thread David Malcolm
From: Trevor Saunders On Mon, 2017-10-16 at 11:47 +0100, Pedro Alves wrote: > On 10/14/2017 12:35 AM, David Malcolm wrote: > > > As far as I can tell from your mail, the one issue that blocks that > > is the lack of gdb::unique_xmalloc_ptr. > > > > So here's

[PATCH] c-family: add name_hint/deferred_diagnostic (v2)

2017-10-16 Thread David Malcolm
Here's an updated version of the patch which drops refcounting in favor of using gnu::unique_ptr. One wart with this approach is that the handling of suppressed diagnostics has to happen in both deferred_diagnostic subclasses, rather than in the name_hint class. It would be possible to fix this b

[PATCH] C/C++: more stdlib header hints (PR c/81404)

2017-10-17 Thread David Malcolm
This patch depends on: * "[PATCH] c-family: add name_hint/deferred_diagnostic (v2)" * https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01021.html (waiting review) * [PATCH 3/3] C: hints for missing stdlib includes for macros and types * https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00125.html

[committed] Simplify format_warning_at_substring API

2017-10-17 Thread David Malcolm
The format_warning_at_substring API has a rather clunk way of indicating the location of the pertinent param (if any): a source_range * is passed in, which can be NULL. Doing so requires extracting a range from the location_t and passing around a pointer to it, or NULL, as needed. This patch simp

[PATCH] v2: C/C++: more stdlib header hints (PR c/81404)

2017-10-18 Thread David Malcolm
On Tue, 2017-10-17 at 20:05 +, Joseph Myers wrote: > On Tue, 17 Oct 2017, David Malcolm wrote: > > > It also adds generalizes some of the code for this (and for the > > "std::" > > namespace hints in the C++ frontend), moving it to a new > > c-family/kn

[PATCH] v3: C/C++: more stdlib header hints (PR c/81404)

2017-10-18 Thread David Malcolm
On Wed, 2017-10-18 at 20:40 +, Joseph Myers wrote: > On Wed, 18 Oct 2017, David Malcolm wrote: > > > +{"WINT_MAX", {"", NULL} }, > > +{"WINT_MIN", {"", NULL} } > > These are in / , not . Thanks; here's an updated

Re: [committed] Add gnu::unique_ptr

2017-10-19 Thread David Malcolm
On Thu, 2017-10-19 at 19:23 +0200, Gerald Pfeifer wrote: > On Mon, 16 Oct 2017, David Malcolm wrote: > > For reference, here's what I committed: > > I'm afraid this may have broken the bootstrap with clang? > > In file included from /scratch/tmp/gerald/gcc-HEA

[PATCH] RFC: Preserving locations for variable-uses and constants (PR 43486)

2017-10-20 Thread David Malcolm
[following up on a discussion at Cauldron] This is a work-in-progress attempt at retaining source-location information for uses of variables and for constants: the tree nodes that don't have an EXPR_LOCATION in our internal representation. I'm posting the patch now to check that my approach is co

[PATCH] Include from system.h (PR bootstrap/82610)

2017-10-23 Thread David Malcolm
On Sun, 2017-10-22 at 09:28 +0200, Gerald Pfeifer wrote: > On Thu, 19 Oct 2017, David Malcolm wrote: > > > In file included from /scratch/tmp/gerald/gcc-HEAD/gcc/unique- > > > ptr-tests.cc:23: > > > In file included from /scratch/tmp/gerald/gcc- > > > HEAD/g

Re: [PATCH] Include from system.h (PR bootstrap/82610)

2017-10-23 Thread David Malcolm
On Mon, 2017-10-23 at 15:51 +0200, Richard Biener wrote: > On Mon, Oct 23, 2017 at 2:58 PM, David Malcolm > wrote: > > On Sun, 2017-10-22 at 09:28 +0200, Gerald Pfeifer wrote: > > > On Thu, 19 Oct 2017, David Malcolm wrote: > > > > > In file included from /sc

Re: [PATCH] Include from system.h (PR bootstrap/82610)

2017-10-23 Thread David Malcolm
On Mon, 2017-10-23 at 16:40 +0100, Pedro Alves wrote: > On 10/23/2017 04:17 PM, Jonathan Wakely wrote: > > On 23/10/17 17:07 +0200, Michael Matz wrote: > > > Hi, > > > > > > On Mon, 23 Oct 2017, Richard Biener wrote: > > > > > > > I guess so. But we have to make gdb happy as well. It really > > >

[PATCH] Add INCLUDE_UNIQUE_PTR and use it (PR bootstrap/82610)

2017-10-23 Thread David Malcolm
On Mon, 2017-10-23 at 16:40 +0100, Pedro Alves wrote: > On 10/23/2017 04:17 PM, Jonathan Wakely wrote: > > On 23/10/17 17:07 +0200, Michael Matz wrote: > > > Hi, > > > > > > On Mon, 23 Oct 2017, Richard Biener wrote: > > > > > > > I guess so. But we have to make gdb happy as well. It really > > >

Re: [PATCH] Add INCLUDE_UNIQUE_PTR and use it (PR bootstrap/82610)

2017-10-23 Thread David Malcolm
On Mon, 2017-10-23 at 21:43 +0200, Gerald Pfeifer wrote: > On Mon, 23 Oct 2017, David Malcolm wrote: > > Here's a different patch, which instead moves the include of our > > "unique-ptr.h" to system.h (conditionalized on INCLUDE_UNIQUE_PTR), > > after the decl o

Re: [RFA][PATCH] Provide a class interface to ssa_propagate

2017-10-24 Thread David Malcolm
On Tue, 2017-10-24 at 11:40 -0600, Jeff Law wrote: > tree-ssa-propagate.c provides a fairly generic engine to propagate > values through a lattice while in SSA form. The engine uses two > callbacks to allow passes to provide pass specific handling of > statements and phi nodes. > > The callback m

Re: [RFA][PATCH] Provide a class interface into substitute_and_fold.

2017-10-24 Thread David Malcolm
On Tue, 2017-10-24 at 12:44 -0600, Jeff Law wrote: > This is similar to the introduction of the ssa_propagate_engine, but > for > the substitution/replacements bits. > > In a couple places the pass specific virtual functions are just > wrappers > around existing functions. A good example of this

Re: [PATCH] C: detect more missing semicolons (PR c/7356)

2017-10-25 Thread David Malcolm
On Wed, 2017-10-25 at 09:59 -0600, Jeff Law wrote: > On 10/11/2017 01:32 PM, David Malcolm wrote: > > [This patch assumes the two patches here: > > https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00274.html ] > > I see the patch directly referenced in that message on the &g

Re: [Diagnostic Patch] don't print column zero

2017-10-26 Thread David Malcolm
[CCing Rainer and Mike for the gcc-dg.exp part] On Thu, 2017-10-26 at 07:33 -0400, Nathan Sidwell wrote: > On the modules branch, I'm starting to add location > information. Line > numbers don't really make sense when reporting errors reading a > binary > file, so I wanted to change the diagnos

Re: [committed][PATCH] Convert sprintf warning code to a dominator walk

2017-10-27 Thread David Malcolm
On Fri, 2017-10-27 at 10:55 -0600, Jeff Law wrote: > Prereq for eventually embedding range analysis into the sprintf > warning > pass. The only thing that changed since the original from a few days > ago was the addition of FINAL OVERRIDE to the before_dom_children > override function. > > Re-boo

Re: [PATCH 2/7] GCOV: introduce usage of terminal colors.

2017-10-30 Thread David Malcolm
On Mon, 2017-10-30 at 08:17 -0400, Nathan Sidwell wrote: > On 10/26/2017 04:11 AM, marxin wrote: > > I consider using colors in context of gcov as very useful. There's > > example for tramp3d: > > https://pste.eu/p/Tl2D.html > > nice! > > > gcc/ChangeLog: > > > > 2017-10-23 Martin Liska > >

[committed] diagnostics: get rid of *_at_rich_loc in favor of overloading

2017-10-31 Thread David Malcolm
Adding a fix-it hint currently involves changing e.g.: error_at (token->location, "unknown type name %qE; did you mean %qs?", token->value, hint); to: gcc_rich_location richloc (token->location); richloc.add_fixit_replace (hint); error_at_rich_loc (&richloc,

[committed] pt.c: add missing %< and %>

2017-10-31 Thread David Malcolm
This patch fixes some missing quoting of a source code element within a diagnostic: a reference to "#include ". Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu; Commited to trunk as r254281. gcc/cp/ChangeLog: * pt.c (listify): Use %< and %> for description of #include. gcc

[committed] jit: add a way to preserve testsuite executables

2017-10-31 Thread David Malcolm
The jit documentation has instructions on running testsuite executables under the debugger, but I realize now that the executables were always being deleted after being run, and I've always been hacking up my jit.exp to prevent this, to allow for debugging them. This patch adds a PRESERVE_EXECUTAB

Re: [PATCH] RFC: Preserving locations for variable-uses and constants (PR 43486)

2017-10-31 Thread David Malcolm
On Tue, 2017-10-24 at 09:53 -0400, Jason Merrill wrote: > On Fri, Oct 20, 2017 at 5:53 PM, David Malcolm > wrote: > > Design questions: > > > > * The patch introduces a new kind of tree node, currently called > > DECL_WRAPPER_EXPR (although it's used for wrap

Re: [committed] diagnostics: get rid of *_at_rich_loc in favor of overloading

2017-10-31 Thread David Malcolm
On Tue, 2017-10-31 at 23:20 +, Joseph Myers wrote: > To confirm: can you make sure that exgettext (via "make gcc.pot") > still > works to extract messages from these overloaded functions for > translation? > It *should* work, because the msgid argument is at the same position > for > all over

[committed] Move selftest::test_diagnostic_context to its own header

2017-11-02 Thread David Malcolm
It's useful to not rely on global_dc in selftests, so this patch moves class selftest::test_diagnostic_context from diagnostic-show-locus.c to a new header and source file. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Committed to trunk as r254354. gcc/ChangeLog: * Make

[committed] Add selftest for diagnostic_get_location_text

2017-11-02 Thread David Malcolm
This patch adds some selftesting of diagnostic_get_location_text, since Nathan was looking at rewriting the insides. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. I also tested it with: LANG=de_DE.UTF-8 make selftest to avoid recurrences of PR bootstrap/71481 comment #8. Commit

[PATCH] RFC: add taxonomy IDs to diagnostics (CERT C, CWE, etc)

2017-11-02 Thread David Malcolm
We currently identify our diagnostics via command-line options, and by the text of the option itself. This patch adds a way to supply metadata with a diagnostic, classifying the problem being reported, according to one of the software problem taxonomies e.g. "INT15-C" within the CERT C Secure Codi

[PATCH] c-family: add name_hint/deferred_diagnostic (v3)

2017-11-02 Thread David Malcolm
Jeff: You previously had concerns about the refcounting used in v1 of this patch; this avoids that in favor of using gnu::unique_ptr. Joseph already approved the C frontend parts of v2 of this patch. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? Changed in v3: - W

[PATCH] C/C++: more stdlib header hints (PR c/81404) (v4)

2017-11-02 Thread David Malcolm
Here's an updated version of the patch. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? Changed in v4: - updated for changes of "inform_at_rich_loc" to "inform" - added #define INCLUDE_UNIQUE_PTR to known-headers.cc Changed in v3: - fixed WINT_MAX and WINT_MIN Chang

[PATCH] ipa-fnsummary.c: fix use-after-free crash (PR jit/82826)

2017-11-03 Thread David Malcolm
PR jit/82826 reports a crash when running jit.dg/test-benchmark.c, introduced by r254140 (aka "Extend ipa-pure-const pass to propagate malloc attribute.") I see the crash on the 28th of 400 in-process iterations of the compiler; on turning on GCC_JIT_BOOL_OPTION_SELFCHECK_GC, it shows up on the 2n

[PATCH] C/C++: more stdlib header hints (PR c/81404) (v5)

2017-11-03 Thread David Malcolm
On Fri, 2017-11-03 at 17:49 +, Joseph Myers wrote: > On Thu, 2 Nov 2017, David Malcolm wrote: > > > +{"offsetof", {"", ""} }, > > offsetof is in stddef.h for C, not stdalign.h. Thanks. Here's an updated version of the patch whi

Re: [PATCH] C/C++: add fix-it hints for various missing symbols

2017-07-05 Thread David Malcolm
On Mon, 2017-07-03 at 23:01 +, Joseph Myers wrote: > Does the changed location fix bug 7356? The patch as-written doesn't affect that bug, since the patch only affects sites that use c_parser_require and cp_parser_require with certain token types, and the diagnostic in PR 7356 is emitted by th

[committed] v2: diagnostics: fix end-points of ranges within macros (PR c++/79300)

2017-07-06 Thread David Malcolm
On Mon, 2017-07-03 at 10:07 -0600, Jeff Law wrote: > On 02/02/2017 01:53 PM, David Malcolm wrote: > > PR c++/79300 identifies an issue in which diagnostics_show_locus > > prints the wrong end-point for a range within a macro: > > > >assert ((p + val

Re: ToT build failure?

2017-07-06 Thread David Malcolm
On Thu, 2017-07-06 at 10:05 -0700, Steve Ellcey wrote: > Is anyone else having problems building a cross-gcc where an intial > gcc with C only is built first and used to build glibc? I am > trying this (it worked before) and am getting: > > /local/sellcey/gcc-aarch64/obj/gcc_initial/./gcc/xgcc >

Re: ToT build failure?

2017-07-06 Thread David Malcolm
On Thu, 2017-07-06 at 13:18 -0400, David Malcolm wrote: > On Thu, 2017-07-06 at 10:05 -0700, Steve Ellcey wrote: > > Is anyone else having problems building a cross-gcc where an intial > > gcc with C only is built first and used to build glibc? I am > > trying this (it

[committed] libcpp: preserve ranges within macro expansions (PR c++/79300)

2017-07-07 Thread David Malcolm
Comment #4 of PR c++/79300 noted a place in which we fail to underline the full token of a macro name in maybe_unwind_expanded_macro_loc. Root cause is that linemap_macro_loc_to_def_point drops range information too early when following the macro expansions; fixed thusly. Successfully bootstrappe

[committed] diagnostics: support compact printing of secondary locations

2017-07-11 Thread David Malcolm
On Mon, 2017-07-03 at 19:57 +0100, Richard Sandiford wrote: > [Thanks for all your diagnostic work btw.] > > David Malcolm writes: > > clang can also print notes about matching opening symbols > > e.g. the note here: > > > > missing-symbol-2.c:25:22: error

[PATCH 0/3] C/C++: show pertinent open token when missing a close token

2017-07-11 Thread David Malcolm
[This patch kit is effectively just one patch; I've split it up into 3 parts, in the hope of making it easier to review: the c-family parts, the C parts, and the C++ parts] This patch adds a hint to the user to various errors generated in the C frontend by: c_parser_require (parser, CPP_CLOSE

[PATCH 1/3] matching tokens: c-family parts

2017-07-11 Thread David Malcolm
OK for trunk? (assuming the rest is approved) gcc/c-family/ChangeLog: * c-common.c (c_parse_error): Add rich_location * param, using it rather implicitly using input_location. * c-common.h (c_parse_error): Add rich_location * param. gcc/testsuite/ChangeLog: * c-c++

[PATCH 2/3] matching tokens: C parts

2017-07-11 Thread David Malcolm
OK for trunk? (assuming the rest is approved) gcc/c/ChangeLog: * c-parser.c (c_parser_error): Rename to... (c_parser_error_richloc): ...this, making static, and adding "richloc" parameter, passing it to the c_parse_error call, rather than calling c_parser_set_source

[PATCH 3/3] matching tokens: C++ parts

2017-07-11 Thread David Malcolm
OK for trunk? (assuming the rest is approved) gcc/cp/ChangeLog: * parser.c (cp_parser_error): Update for new param to c_parse_error. (class token_pair): New class. (class matching_parens): New class. (class matching_braces): New class. (cp_parser_sta

Re: [PATCH] Add quotes to error messages related to Sanitizers.

2017-07-11 Thread David Malcolm
On Mon, 2017-07-10 at 11:36 +0200, Martin Liška wrote: > Hi. > > This adds missing quotes to various error messages related to > AddressSanitizer. > Patch can bootstrap on ppc64le-redhat-linux and survives regression > tests. > > Ready to be installed? LGTM, with my "diagnostic messages" maintai

Re: [PATCH 0/3] C/C++: show pertinent open token when missing a close token

2017-07-11 Thread David Malcolm
On Tue, 2017-07-11 at 11:28 -0600, Martin Sebor wrote: > On 07/11/2017 09:24 AM, David Malcolm wrote: > > [This patch kit is effectively just one patch; I've split it up > > into > > 3 parts, in the hope of making it easier to review: > > the c-family parts

[committed] diagnostics: fix crash when consolidating out-of-order fix-it hints (PR c/81405)

2017-07-13 Thread David Malcolm
PR c/81405 identifies a crash when printing fix-it hints from -Wmissing-braces when there are excess elements. The fix-it hints are bogus (which I've filed separately as PR c/81432), but they lead to a crash within the fix-it consolidation logic I added in r247548, in line_corrections::add_hint.

Re: c-family PATCH to improve -Wsign-compare (PR c/81417)

2017-07-13 Thread David Malcolm
On Thu, 2017-07-13 at 18:33 +0200, Marek Polacek wrote: > A tiny patch for -Wsign-compare so that is also prints the types when > reporting a warning. > > Bootstrapped/regtested on x86_64-linux and ppc64le-redhat-linux, ok > for trunk? Looks like it always display the types in the order signed th

Re: c-family PATCH to improve -Wsign-compare (PR c/81417)

2017-07-13 Thread David Malcolm
On Thu, 2017-07-13 at 16:39 -0400, Eric Gallager wrote: > On 7/13/17, David Malcolm wrote: > > On Thu, 2017-07-13 at 18:33 +0200, Marek Polacek wrote: > > > A tiny patch for -Wsign-compare so that is also prints the types > > > when > > > reporting a warning.

Re: [PATCH][RFA/RFC] Stack clash mitigation patch 01/08

2017-07-13 Thread David Malcolm
On Tue, 2017-07-11 at 15:19 -0600, Jeff Law wrote: [...] > diff --git a/gcc/opts.c b/gcc/opts.c > index 7460c2b..61f5bb0 100644 > --- a/gcc/opts.c > +++ b/gcc/opts.c > @@ -2243,6 +2243,19 @@ common_handle_option (struct gcc_options > *opts, > opts->x_flag_stack_check = STACK_CHECK_BUILTIN

[PING] [PATCH] v3: C/C++: fix quoting of "aka" typedef information (PR 62170)

2017-07-14 Thread David Malcolm
Jason, is this updated version of the patch OK? https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01580.html Thanks Dave On Wed, 2017-06-21 at 10:32 -0400, David Malcolm wrote: > On Tue, 2017-06-20 at 15:11 -0400, Jason Merrill wrote: > > On Tue, Jun 20, 2017 at 3:06 PM, Davi

Re: [PING^4] {C++ PATCH] Fix-it hints for wrong usage of 'friend' and 'auto'

2017-07-17 Thread David Malcolm
On Sun, 2017-07-16 at 12:13 +0200, Volker Reichelt wrote: > Hi, > > this is PING^4 for a C++ patch that adds fix-it hints for wrong usage > of 'friend' and 'auto': > > https://gcc.gnu.org/ml/gcc-patches/2017-04/msg01575.html I notice that the patch slightly changes the apparent indentation withi

[PATCH] Fix selftest::read_file for empty file

2017-07-19 Thread David Malcolm
selftest::read_file currently assumes it has a non-empty file; when loading an empty file it dies with an assertion failure, or a write through NULL if assertions are disabled. This patch fixes this case, removing this limitation. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu; takes -f

Re: C PATCH to display types when printing a conversion warning (PR c/81233)

2017-07-19 Thread David Malcolm
On Thu, 2017-07-13 at 16:18 +0200, Marek Polacek wrote: > This patch improves diagnostic in the C FE by printing the types when > reporting > a problem with a conversion. E.g., instead of > >warning: assignment from incompatible pointer type > > you'll now get > > warning: assignment to

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-21 Thread David Malcolm
On Thu, 2017-07-20 at 18:35 +0200, Volker Reichelt wrote: > Hi, > > the following patch introduces a new C++ warning option > -Wduplicated-access-specifiers that warns about redundant > access-specifiers in classes, e.g. > > class B > { > public: > B(); > > private: > voi

Re: C PATCH to fix bogus warning with -Wmultistatement-macros (PR c/81364)

2017-07-21 Thread David Malcolm
On Fri, 2017-07-14 at 15:38 +0200, Marek Polacek wrote: > I think David might be able to approve this one, so CCing. It's something of a stretch for my "diagnostic messages" maintainer hat, but I've looked over these changes and they look good to me. Dave > On Tue, Jul 11, 2017 at 03:23:16PM +02

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-21 Thread David Malcolm
On Fri, 2017-07-21 at 11:56 -0400, David Malcolm wrote: > On Thu, 2017-07-20 at 18:35 +0200, Volker Reichelt wrote: > > Hi, > > > > the following patch introduces a new C++ warning option > > -Wduplicated-access-specifiers that warns about redundant > >

Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers'

2017-07-21 Thread David Malcolm
On Fri, 2017-07-21 at 19:58 +0200, Volker Reichelt wrote: > On 21 Jul, David Malcolm wrote: > > On Thu, 2017-07-20 at 18:35 +0200, Volker Reichelt wrote: > >> Hi, > >> > >> the following patch introduces a new C++ warning option > >> -Wduplicated

[PATCH 00/17] RFC: New source-location representation; Language Server Protocol

2017-07-24 Thread David Malcolm
e deeply. (I experimented with using it to fix some of our missing location information for things like uses of constants and variables as arguments at callsites, but it quickly turned into a much more invasive patch). * The LSP implementation is a just a proof-of-concept, to further motivate

[PATCH 03/17] Core of BLT implementation

2017-07-24 Thread David Malcolm
This patch implements the core of the new "blt" type: an optional "on-the-side" hierarchical recording of source ranges, associated with grammar productions, with a sparse mapping to our regular "tree" type. Caveats: * the name is a placeholder (see the comment in blt.h) * I'm ignoring memory mana

[PATCH 01/17] Add param-type-mismatch.c/C testcases as a baseline

2017-07-24 Thread David Malcolm
Amongst other things, this patch kit aims to improve our handling of mismatched types within function calls. For example, given: extern int callee_1 (int one, const char *two, float three); int test_1 (int first, int second, float third) { return callee_1 (first, second, third); } t

[PATCH 02/17] diagnostics: support prefixes within diagnostic_show_locus

2017-07-24 Thread David Malcolm
This patch reworks diagnostic_show_locus so that it respects the prefix of the pretty_printer. This is used later in the patch kit for embedding source dumps within a hierarchical tree-like dump, by using the ASCII art for the tree as the prefix. gcc/c-family/ChangeLog: * c-opts.c (c_diag

<    23   24   25   26   27   28   29   30   31   32   >