[PING] Re: [PATCH] c/c++: Add fix-it hints for suggested missing #includes

2017-05-26 Thread David Malcolm
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00321.html On Thu, 2017-05-04 at 12:36 -0400, David Malcolm wrote: > As of r247522, fix-it-hints can suggest the insertion of new lines. > > This patch uses this to implement a new "maybe_add_include_fixit" > function

[PING] Re: [PATCH 1/3] c-family: add name_hint/deferred_diagnostic

2017-05-26 Thread David Malcolm
.html [PATCH 3/3] C: hints for missing stdlib includes for macros and types https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00438.html On Fri, 2017-05-05 at 13:51 -0400, David Malcolm wrote: > In various places we use lookup_name_fuzzy to provide a hint, > and can report messages

[PING] Re: [PATCH] Fix-it hints for -Wimplicit-fallthrough

2017-05-26 Thread David Malcolm
Ping: https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00334.html On Thu, 2017-05-04 at 14:16 -0400, David Malcolm wrote: > As of r247522, fix-it-hints can suggest the insertion of new lines. > > This patch updates -Wimplicit-fallthrough to provide suggestions > with fix-it hints,

Re: [PATCH 0/3] v3 of C++ template type diffing

2017-05-30 Thread David Malcolm
On Wed, 2017-05-10 at 09:34 -0400, Nathan Sidwell wrote: > On 05/09/2017 09:41 PM, David Malcolm wrote: > > On Tue, 2017-05-09 at 10:52 -0400, Nathan Sidwell wrote: > > > I split out the non-c++ bits into a separate patch. > > > > v3 of the patch kit is thus thr

Re: C/C++ PATCH to implement -Wmultiline-expansion (PR c/80116)

2017-06-01 Thread David Malcolm
On Thu, 2017-06-01 at 18:45 +0200, Marek Polacek wrote: > A motivating example for this warning can be found e.g. in > > PRE10-C. Wrap multistatement macros in a do-while loop > https://www.securecoding.cert.org/confluence/x/jgL7 > > i.e., > > #define SWAP(x, y) \ > tmp = x; \ > x = y;

[PATCH] testsuite: ensure GCC_COLORS is unset

2017-06-01 Thread David Malcolm
Dominique noted on IRC that the new test show-template-tree-color.C (r248698) fails when GCC_COLORS is set in the environment. The following patch unsets GCC_COLORS within gcc-dg.exp, fixing this issue. Successfully regrtested on x86_64-pc-linux-gnu; I also verified the fix of the failing test by

[committed] Fix segfault in free_growth_caches (PR jit/80954)

2017-06-02 Thread David Malcolm
r248336 added these lines to free_growth_caches if (edge_removal_hook_holder) symtab->remove_edge_removal_hook (edge_removal_hook_holder); which broke the JIT; attempts to compile more than one time within a single process segfault here: 305 symbol_table::remove_edge_removal_hook (cgra

Re: [PATCH] C++ parser: Fix typos in error messages

2017-06-05 Thread David Malcolm
On Tue, 2017-05-02 at 08:05 +0200, Volker Reichelt wrote: > Hi, > > the following patch fixes two typos in error messages of the C++ > parser > (which have gone unnoticed since GCC 3.4.0). > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > OK for trunk? > Should this go also to GCC 7.2? >

[PING^2] re [PATCH v2] C++: Add fix-it hints for -Wold-style-cast

2017-06-05 Thread David Malcolm
Ping re this patch: https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00204.html On Fri, 2017-05-26 at 15:35 -0400, David Malcolm wrote: > On Wed, 2017-05-03 at 09:51 -0400, David Malcolm wrote: > > On Thu, 2017-04-27 at 23:03 +0200, Marek Polacek wrote: > > > On Thu, Apr 27,

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

2017-06-05 Thread David Malcolm
PR 62170 describes a problem with how the quoting in pp_format interacts with the "aka" information for typedefs in %qT for the C family of frontends, and also now for %qH and %qI in the C++ frontend. Currently for %qT we print e.g.: ‘Py_ssize_t* {aka int*}’ ^^ colorized

[committed] libcpp: add callback for comment-handling

2017-06-05 Thread David Malcolm
On Fri, 2017-05-12 at 12:47 -0600, Jeff Law wrote: > On 05/02/2017 01:08 PM, David Malcolm wrote: > > Currently the C/C++ frontends discard comments when parsing. > > It's possible to set up libcpp to capture comments as tokens, > > by setting CPP_OPTION (pfile,

[PATCH] gcc-dg.exp: support more than one digit in relative line number notation

2016-12-27 Thread David Malcolm
In r240391 Jakub added relative line number notation (.+4 or .-1 etc) for DejaGnu messages. This patch tweaks the regex to allow relative line numbers containing more than one digit (I ran into this with a test for a diagnostic that issues multiple notes, for which I wanted to verify the diagnosti

PING Re: [PATCH] Add x86_64-specific selftests for RTL function reader (v2)

2017-01-03 Thread David Malcolm
Ping: https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01616.html (the patch has been successfully bootstrap®rtested on x86_64-pc-linux-gnu, and also tested on i686-pc-linux-gnu). On Mon, 2016-12-19 at 12:12 -0500, David Malcolm wrote: > Note to i386 maintainters: this patch is part of the

[PATCH] C++: fix fix-it hints for misspellings within explicit namespaces

2017-01-03 Thread David Malcolm
PR c++/77829 and PR c++/78656 identify an issue within the C++ frontend where it issues nonsensical fix-it hints for misspelled name lookups within an explicitly given namespace: it finds the closest name within all namespaces, and uses the location of the namespace for the replacement, rather than

Re: [PATCH] Fix -fself-test ICE in non-english locale (PR bootstrap/77569)

2017-01-03 Thread David Malcolm
On Wed, 2017-01-04 at 00:01 +0100, Jakub Jelinek wrote: > Hi! > > The cb.error hook is called in the case we are looking for with > _("conversion from %s to %s not supported by iconv") > where _(msgid) is dgettext ("cpplib", msgid), so if performing -fself > -test > on iconv that doesn't support e

Re: [bootstrap-O3] add a default initializer to avoid a warning at -O3

2017-01-04 Thread David Malcolm
On Wed, 2017-01-04 at 09:04 -0700, Jeff Law wrote: > On 01/04/2017 06:42 AM, Jason Merrill wrote: > > On Wed, Jan 4, 2017 at 8:13 AM, Alexandre Oliva > > wrote: > > > On Jan 3, 2017, Jason Merrill wrote: > > > > > > > Are there bugzillas for these false positive warnings? > > > > > > I don't t

[committed] Introduce RTL function reader

2017-01-05 Thread David Malcolm
On Thu, 2017-01-05 at 10:43 +0100, Uros Bizjak wrote: > On Tue, Jan 3, 2017 at 5:47 PM, David Malcolm > wrote: > > Ping: > > https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01616.html > > > > (the patch has been successfully bootstrap®rtested on > > x86_64-p

[PATCH, gimplefe] passes.c: split out pass-skipping logic into subroutines

2017-01-05 Thread David Malcolm
The GIMPLE frontend's pass-skipping logic in execute_one_pass is somewhat awkward. This patch splits it out into two subroutines to simplify things. No functional change intended (and this may make it easier to update the logic so that it can be shared with the RTL frontend). Successfully bootst

Re: [committed] Introduce RTL function reader

2017-01-06 Thread David Malcolm
On Fri, 2017-01-06 at 17:25 +0100, Jakub Jelinek wrote: > On Thu, Jan 05, 2017 at 03:20:26PM -0500, David Malcolm wrote: > > + /* Handle "reuse_rtx". */ > > + if (strcmp (code_name, "reuse_rtx") == 0) > > +{ > > + read_name (

Re: [committed] Introduce RTL function reader

2017-01-06 Thread David Malcolm
On Fri, 2017-01-06 at 10:25 -0700, Jeff Law wrote: > On 01/06/2017 09:43 AM, David Malcolm wrote: > > On Fri, 2017-01-06 at 17:25 +0100, Jakub Jelinek wrote: > > > On Thu, Jan 05, 2017 at 03:20:26PM -0500, David Malcolm wrote: > > > > + /* Handle "reuse_rtx&quo

[committed] Fix linemap corruption after very wide source lines (PR c++/72803)

2017-01-07 Thread David Malcolm
PR c++/72803 describes an issue where a fix-it hint is to be emitted at column 512 of a 511-column source line, leading to an ICE. The root cause is a bug in linemap_line_start, when transitioning from lines >= 512 in width to narrow lines. The wide line in the reproducer has a line map with: m

[PATCH 9a] Add "__RTL" to C frontend

2017-01-09 Thread David Malcolm
This part of the patch adds the ability to tag a function with "__RTL", analogous to the "__GIMPLE" tag. gcc/c-family/ChangeLog: * c-common.c (c_common_reswords): Add "__RTL". * c-common.h (enum rid): Add RID_RTL. gcc/c/ChangeLog: * c-parser.c: Include "read-rtl-function.h

[PATCH 9b] Don't assume that copy tables were initialized

2017-01-09 Thread David Malcolm
gcc/ChangeLog: * cfg.c (original_copy_tables_initialized_p): New function. * cfg.h (original_copy_tables_initialized_p): New decl. * cfgrtl.c (relink_block_chain): Guard the call to free_original_copy_tables with a call to original_copy_tables_initialized_p.

[PATCH 9/9] Add "__RTL" to cc1 (v8)

2017-01-09 Thread David Malcolm
it, rather than having the callgraph control this. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu; v7 was successfully built for 191 target configurations. David Malcolm (10): Add "__RTL" to C frontend Don't assume that copy tables were initialized callgraph: handle

[PATCH 9c] callgraph: handle __RTL functions

2017-01-09 Thread David Malcolm
The RTL backend code is full of singleton state, so we have to handle functions as soon as we parse them. This requires various special-casing in the callgraph code. gcc/ChangeLog: * cgraph.h (symtab_node::native_rtl_p): New decl. * cgraphunit.c (symtab_node::native_rtl_p): New fu

[PATCH 9i] testsuite: add aarch64-specific files

2017-01-09 Thread David Malcolm
gcc/testsuite/ChangeLog: * gcc.dg/rtl/aarch64/asr_div1.c: New test case. * gcc.dg/rtl/aarch64/pr71779.c: New test case. --- gcc/testsuite/gcc.dg/rtl/aarch64/asr_div1.c | 41 +++ gcc/testsuite/gcc.dg/rtl/aarch64/pr71779.c | 50 + 2 fi

[PATCH 9e] Update "startwith" logic for pass-skipping to handle __RTL functions

2017-01-09 Thread David Malcolm
gcc/ChangeLog: * passes.c: Include "insn-addr.h". (should_skip_pass_p): Add logging. Update logic for running "expand" to be compatible with both __GIMPLE and __RTL. Guard property-provider override so it is only done for gimple passes. Don't skip dfinit.

[PATCH 9g] Extend .md and RTL parsing to support being wired up to cc1

2017-01-09 Thread David Malcolm
gcc/ChangeLog: * read-md.c (md_reader::read_char): Support filtering the input to a subset of line numbers. (md_reader::md_reader): Initialize fields m_first_line and m_last_line. (md_reader::read_file_fragment): New function. * read-md.h (md_reader::

[PATCH 9d] Don't call delete_tree_ssa for __RTL functions

2017-01-09 Thread David Malcolm
gcc/ChangeLog: * final.c (rest_of_clean_state): Don't call delete_tree_ssa for __RTL functions. --- gcc/final.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/final.c b/gcc/final.c index 8a4c9f8..2483381 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4699

[PATCH 9h] testsuite: add platform-independent files

2017-01-09 Thread David Malcolm
This patch adds: - an rtl.exp (to make it easy to run just the tests for __RTL-tagged functions) - a test.c source file I used when generating the various RTL dumps (for reference) - a couple of tests of __RTL parser errors gcc/testsuite/ChangeLog: * gcc.dg/rtl/rtl.exp: New file.

[PATCH 9f] Add a way for the C frontend to compile __RTL-tagged functions

2017-01-09 Thread David Malcolm
The backend is full of singleton state, so we have to compile __RTL-functions as soon as we parse them. This means that the C frontend needs to invoke the backed. This patch adds the support needed. Normally this would be a no-no, and including rtl headers is blocked by this within system.h: /

[PATCH 9j] testsuite: add x86_64-specific files

2017-01-09 Thread David Malcolm
A collection of test cases, capturing the state of various functions at various places within the pass list, and verifying that we can restart at various passes. gcc/testsuite/ChangeLog: * gcc.dg/rtl/x86_64/dfinit.c: New test case. * gcc.dg/rtl/x86_64/different-structs.c: New test

[PATCH] Offer suggestions for unrecognized sanitizer options (PR driver/78877)

2017-01-10 Thread David Malcolm
PR driver/78877 notes that we offer a suggestion for "-fsanitize-addres" (with a hyphen): xgcc: error: unrecognized command line option '-fsanitize-addres'; did you mean '-fsanitize=address'? but not for "-fsanitize=addres" (with an equals sign): xgcc: error: unrecognized argument to -fsan

[committed] Fix issues with unrepresentable column numbers (PR c++/77949)

2017-01-10 Thread David Malcolm
PR c++/77949 identifies an ICE when the C++ frontend attempts to emit a fix-it hint inserting a missing semicolon at column 4097 of a source file. This column value exceeds LINE_MAP_MAX_COLUMN_NUMBER and hence isn't representable using a location_t. Attempting to do so leads to these problems, wh

[PATCH v2] Offer suggestions for unrecognized sanitizer options (PR driver/78877)

2017-01-10 Thread David Malcolm
On Tue, 2017-01-10 at 20:49 +0100, Jakub Jelinek wrote: > On Tue, Jan 10, 2017 at 03:02:49PM -0500, David Malcolm wrote: > > +/* Given ARG, an unrecognized sanitizer option, return the best > > + matching sanitizer option, or NULL if there isn't one. */ > >

[committed] Don't suppress bogus usage of macros from system headers in -Wformat (PR c/78304)

2017-01-13 Thread David Malcolm
c-lex.c: lex_string uses cpp_get_token rather than cpp_get_token_with_location, and hence the C family of frontends record the physical locations of tokens in string concatenations, rather than the virtual locations, discarding any macro expansion information. The resulting *tree* node from the co

[PATCH] system.h: Poison strndup (PR bootstrap/78616)

2017-01-13 Thread David Malcolm
This patch poisons strndup (in system.h), as requested in the discussion of PR bootstrap/78616. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: PR bootstrap/78616 * system.h: Poison strndup. --- gcc/system.h | 3 ++- 1 file changed, 2 inser

Re: [PATCH] C++: fix fix-it hints for misspellings within explicit namespaces

2017-01-13 Thread David Malcolm
On Wed, 2017-01-04 at 14:58 -0500, Jason Merrill wrote: > On Tue, Jan 3, 2017 at 8:28 PM, David Malcolm > wrote: > > PR c++/77829 and PR c++/78656 identify an issue within the C++ > > frontend > > where it issues nonsensical fix-it hints for misspelled name > > lo

[PATCH] Fix testcase for PR c/78304

2017-01-16 Thread David Malcolm
On Mon, 2017-01-16 at 13:31 +0100, Rainer Orth wrote: > Hi Christophe, > > > > Successfully bootstrapped®rtested on x86_64-pc-linux-gnu; > > > adds 34 PASS results to gcc.sum. > > > > > These 2 tests fail on arm: > > > > gcc.dg/format/pr78304.c (test for warnings, line 9) > > gcc.dg/form

Re: [PATCH 9g] Extend .md and RTL parsing to support being wired up to cc1

2017-01-16 Thread David Malcolm
On Mon, 2017-01-16 at 15:04 -0700, Jeff Law wrote: > On 01/09/2017 07:38 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * read-md.c (md_reader::read_char): Support filtering > > the input to a subset of line numbers. > > (md_reader::md_reader): Initialize

Re: [PATCH 9f] Add a way for the C frontend to compile __RTL-tagged functions

2017-01-16 Thread David Malcolm
On Mon, 2017-01-16 at 14:54 -0700, Jeff Law wrote: > On 01/09/2017 07:38 PM, David Malcolm wrote: > > The backend is full of singleton state, so we have to compile > > __RTL-functions as soon as we parse them. This means that the > > C frontend needs to invoke the backed. >

[PATCH] Fix wording of -Wmisleading-indentation (PR c++/71497)

2017-01-17 Thread David Malcolm
Someone pointed out a grammar nit in the -Wmisleading-indentation diagnostic messages, which this patch fixes. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk and for gcc 6? gcc/c-family/ChangeLog: PR c++/71497 * c-indentation.c (warn_for_misleading_indenta

Re: [PATCH 9c] callgraph: handle __RTL functions

2017-01-17 Thread David Malcolm
On Tue, 2017-01-17 at 13:35 +0100, Jan Hubicka wrote: > > On Mon, Jan 16, 2017 at 10:25 PM, Jeff Law wrote: > > > On 01/09/2017 07:38 PM, David Malcolm wrote: > > > > > > > > The RTL backend code is full of singleton state, so we have to > > > >

[PATCH] Introduce opt_pass::skip virtual function

2017-01-17 Thread David Malcolm
On Tue, 2017-01-17 at 10:28 +0100, Richard Biener wrote: > On Mon, Jan 16, 2017 at 10:42 PM, Jeff Law wrote: > > On 01/09/2017 07:38 PM, David Malcolm wrote: > > > > > > gcc/ChangeLog: > > > * passes.c: Include "insn-addr.h". > > >

Re: [PATCH] Fix testcase for PR c/78304

2017-01-17 Thread David Malcolm
On Tue, 2017-01-17 at 10:45 +0100, Christophe Lyon wrote: > On 16 January 2017 at 19:50, David Malcolm > wrote: > > On Mon, 2017-01-16 at 13:31 +0100, Rainer Orth wrote: > > > Hi Christophe, > > > > > > > > Successfully bootstrapped®rtested on x86_64

Re: [PATCH 9e] Update "startwith" logic for pass-skipping to handle __RTL functions

2017-01-18 Thread David Malcolm
On Wed, 2017-01-18 at 09:36 -0700, Jeff Law wrote: > On 01/17/2017 02:28 AM, Richard Biener wrote: > > > > > > This feels somewhat different, but still a hack. > > > > > > I don't have strong suggestions on how to approach this, but what > > > we've got > > > here feels like a hack and one prone

[committed] jit.dg: fix issue with compilation of test-threads.c

2017-01-18 Thread David Malcolm
DejaGnu's provides decls of various inline functions, of which the jit testsuite uses "pass", "fail" and "note". The jit testcase test-threads.c jumps through some hoops to make these functions threadsafe, using macros to rename the implementation in dejagnu.h, giving them a "dejagnu_" prefix, th

[committed] Implement LANG_HOOKS_TYPE_FOR_SIZE for jit

2017-01-18 Thread David Malcolm
The jit testcase test-nested-loops.c was crashing. Root cause is that deep inside loop optimization we're now exposing this call within fold-const.c which wasn't being hit before: 4082 /* Compute the mask to access the bitfield. */ 4083 unsigned_type = lang_hooks.types.type_for_size (*

[PATCH] C++: fix fix-it hints for misspellings within explicit namespaces (v2)

2017-01-18 Thread David Malcolm
On Sat, 2017-01-14 at 09:50 -0500, Jason Merrill wrote: > On Fri, Jan 13, 2017 at 5:05 PM, David Malcolm > wrote: > > On Wed, 2017-01-04 at 14:58 -0500, Jason Merrill wrote: > > > On Tue, Jan 3, 2017 at 8:28 PM, David Malcolm < > > > dmalc...@redhat.com> > &

[PATCH] Make LTO's implementation of LANG_HOOKS_TYPE_FOR_SIZE the default

2017-01-19 Thread David Malcolm
On Thu, 2017-01-19 at 10:36 +0100, Richard Biener wrote: > On Wed, Jan 18, 2017 at 10:45 PM, David Malcolm > wrote: > > The jit testcase test-nested-loops.c was crashing. > > > > Root cause is that deep inside loop optimization we're now exposing > > this ca

[PATCH, v2] (9e) Update "startwith" logic for pass-skipping to handle __RTL functions

2017-01-19 Thread David Malcolm
On Mon, 2017-01-16 at 14:42 -0700, Jeff Law wrote: > On 01/09/2017 07:38 PM, David Malcolm wrote: > > gcc/ChangeLog: > > * passes.c: Include "insn-addr.h". > > (should_skip_pass_p): Add logging. Update logic for running > > "expand"

Re: [PATCH] C++: fix fix-it hints for misspellings within explicit namespaces (v2)

2017-01-19 Thread David Malcolm
On Thu, 2017-01-19 at 13:15 -0500, Jason Merrill wrote: > On Wed, Jan 18, 2017 at 5:29 PM, David Malcolm > wrote: > > Here's a version of the patch which simply tweaks > > cp_parser_primary_expression's call to finish_id_expression so that > > it passes the loc

Re: [PATCH, v2] (9e) Update "startwith" logic for pass-skipping to handle __RTL functions

2017-01-20 Thread David Malcolm
On Fri, 2017-01-20 at 09:06 +0100, Richard Biener wrote: > On Thu, Jan 19, 2017 at 6:22 PM, David Malcolm > wrote: > > On Mon, 2017-01-16 at 14:42 -0700, Jeff Law wrote: > > > On 01/09/2017 07:38 PM, David Malcolm wrote: > > > > gcc/ChangeLog: > > &

[committed][PATCH 9/9] Add "__RTL" to cc1 (v9)

2017-01-24 Thread David Malcolm
On Fri, 2017-01-20 at 16:16 +0100, Richard Biener wrote: [...] > > Richi: if that patch is approved, are you OK with patch 9 in early > > stage 4? > > Yes. Thanks. All of the various parts of patch 9 have now been approved. I've rebased it, and merged the fixes identified in review. Testing o

Re: [PATCH] BRIG frontend: request for a global review

2017-01-24 Thread David Malcolm
On Tue, 2017-01-24 at 13:52 +0100, Martin Jambor wrote: > Hi, > > On Mon, Jan 23, 2017 at 02:11:37PM +0100, Richard Biener wrote: > > On Mon, Jan 23, 2017 at 1:02 PM, Martin Jambor > > wrote: > > > Hi, > > > > > > > > > On Mon, Jan 23, 2017 at 12:56:13PM +0100, Richard Biener wrote: > > > > On

Re: [PATCH] BRIG frontend: request for a global review

2017-01-24 Thread David Malcolm
On Tue, 2017-01-24 at 15:30 -0500, David Malcolm wrote: > On Tue, 2017-01-24 at 13:52 +0100, Martin Jambor wrote: > > Hi, > > > > On Mon, Jan 23, 2017 at 02:11:37PM +0100, Richard Biener wrote: > > > On Mon, Jan 23, 2017 at 1:02 PM, Martin J

[PATCH] docs: Add __GIMPLE and __RTL to the "Internals" doc

2017-01-26 Thread David Malcolm
The "internals" documentation has a "Testsuites" chapter; this patch adds some notes to it, describing the __GIMPLE and __RTL extensions to the C frontend. Builds; passed visual inspection of .info, .html, .pdf. and .dvi. OK for trunk? gcc/ChangeLog: * doc/sourcebuild.texi (Testsuites):

Re: [New file] Add testcase to ensure that #pragma GCC diagnostic push/pop works with -Wtraditional.

2017-03-24 Thread David Malcolm
On Fri, 2017-03-24 at 14:10 -0400, Eric Gallager wrote: > The attached test case failed with gcc 4.9 and older, but started > compiling successfully with only the 1 expected warning with gcc 5. > Adding it to the test suite would ensure that this behavior doesn't > regress. Thanks for posting thi

[PATCH] Fix description of Wendif-labels (PR documentation/78732)

2017-03-31 Thread David Malcolm
As noted in the PR, c.opt's description of -Wendif-labels erroneously refers to #elif, rather than #else. warn_endif_labels is used by: libcpp/directives.c: do_else libcpp/directives.c: do_endif in which they use it to guard calls to check_eol_endif_labels. It's not used by do_elif. doc/cppw

[PATCH] Fix spelling suggestions for reserved words (PR c++/80177)

2017-03-31 Thread David Malcolm
As noted in the PR, the C++ frontend currently offers a poor suggestion for this misspelling: a.C: In function ???void f()???: a.C:3:3: error: ???static_assertion??? was not declared in this scope static_assertion (1 == 0, "1 == 0"); ^~~~ a.C:3:3: note: suggested alternative: ???

[PATCH] Add gcc_jit_type_get_aligned

2017-03-31 Thread David Malcolm
On Thu, 2017-03-30 at 22:28 +0200, Florian Weimer wrote: > * David Malcolm: > > > Here's a work-in-progress implementation of the idea, adding this > > entrypoint to the API: > > > > extern gcc_jit_type * > > gcc

[wwwdocs, PATCH v2] C++ terminology: the One Definition Rule in diagnostics

2017-04-06 Thread David Malcolm
On Thu, 2017-04-06 at 10:44 -0600, Jeff Law wrote: > On 03/24/2017 03:29 AM, Martin Liška wrote: > > I would like to ping that. I'm not sure what's agreement after I > > read > > discussion in: https://gcc.gnu.org/ml/gcc/2017-03/msg00070.html > > > > Martin Sebor may know, CC'ing him. > Not sure i

Re: [C++ PATCH] New warning for extra semicolons after in-class function definitions

2017-04-07 Thread David Malcolm
On Fri, 2017-04-07 at 21:55 +0200, Volker Reichelt wrote: > Hi, > > with the following patch I suggest to add a diagnostic for extra > semicolons after in-class member function definitions: > > struct A > { > A() {}; > void foo() {}; > friend void bar() {}; > }; > > Although th

Re: [RFC, testsuite] Add dg-save-linenr

2017-04-24 Thread David Malcolm
On Sat, 2017-04-22 at 19:49 +0200, Tom de Vries wrote: > Hi, > > there are currently two types of line number supported in > dg-{error,warning,message,bogus} directives: absolute and relative. > With an absolute line number, it's immediately clear what line number > is > meant, but when a line i

Re: [C++ PATCH] Fix-it info for duplicate tokens

2017-04-24 Thread David Malcolm
On Fri, 2017-04-21 at 18:01 +0200, Volker Reichelt wrote: > Hi, > > the following patch adds fix-it info to error messages in 4 places > where the C++ parser complains about duplicate tokens. > The fix-it infos suggest to remove the duplicates. > > Bootstrapped and regtested on x86_64-pc-linux-gn

[PING for gcc 8] Re: [PATCH] Fix spelling suggestions for reserved words (PR c++/80177)

2017-04-24 Thread David Malcolm
Ping for gcc 8. On Fri, 2017-03-31 at 12:41 -0400, David Malcolm wrote: > As noted in the PR, the C++ frontend currently offers a poor > suggestion for this misspelling: > > a.C: In function ‘void f()’: > a.C:3:3: error: ‘static_assertion’ was not declared in this scope >s

[PATCH, gcc 8] C++: hints for missing std:: headers

2017-04-24 Thread David Malcolm
If the user forgets to include an STL header, then an attempt to use a class in an explicitly scoped "std::" currently leads to this error: test.cc:3:8: error: 'string' is not a member of 'std' std::string s ("hello world"); ^~ This patch attempts to make this error a bit more user

[PATCH] C: fix-it hint for removing stray semicolons

2017-04-24 Thread David Malcolm
Patch adds a fix-it hint to a pre-existing pedwarn to make it easier for IDEs to assist in fixing the mistake. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gcc/c/ChangeLog: * c-parser.c (c_parser_struct_or_union_specifier): Add fix-it hint for removing

[PATCH] C++: fix-it hint for removing stray semicolons

2017-04-24 Thread David Malcolm
Patch adds a fix-it hint to a pre-existing pedwarn to make it easier for IDEs to assist in fixing the mistake. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. OK for trunk? gcc/cp/ChangeLog: * parser.c (cp_parser_member_declaration): Add fix-it hint for removing stray s

[PATCH] C++: fix-it hints suggesting accessors for private fields

2017-04-24 Thread David Malcolm
Given e.g. class foo { public: int get_field () const { return m_field; } private: int m_field; }; ...if the user attempts to access the private field from the wrong place we emit: test.cc: In function ‘int test(foo*)’: test.cc:12:13: error: ‘int foo::m_field’ is private

Re: [RFC, testsuite] Add dg-save-linenr

2017-04-24 Thread David Malcolm
On Mon, 2017-04-24 at 11:20 -0400, David Malcolm wrote: > On Sat, 2017-04-22 at 19:49 +0200, Tom de Vries wrote: > > Hi, > > > > there are currently two types of line number supported in > > dg-{error,warning,message,bogus} directives: absolute and relative. > > W

Re: [PATCH] Add gcc_jit_type_get_aligned

2017-04-24 Thread David Malcolm
On Fri, 2017-03-31 at 17:13 -0400, David Malcolm wrote: > On Thu, 2017-03-30 at 22:28 +0200, Florian Weimer wrote: > > * David Malcolm: > > > > > Here's a work-in-progress implementation of the idea, adding this > > > entrypoint to the A

Re: Who broke options.h?

2017-04-25 Thread David Malcolm
On Tue, 2017-04-25 at 06:59 -0700, Steve Kargl wrote: > Someone (other than Richard who seems to have fixed his > bootstrap issue) in the last 3 days has broken bootstrap > on FreeBSD. The generated file gcc/options.h contains > code of the form > > OPT_C = 116, /*

Re: [PATCH] C++: fix-it hints suggesting accessors for private fields

2017-04-25 Thread David Malcolm
On Tue, 2017-04-25 at 07:49 -0400, Nathan Sidwell wrote: > On 04/25/2017 07:46 AM, Nathan Sidwell wrote: > > On 04/24/2017 04:06 PM, David Malcolm wrote: > > > > > test.cc:12:13: note: field ‘int foo::m_field’ can be accessed via > > > ‘int > > >

Re: [PATCH] C++: fix-it hints suggesting accessors for private fields

2017-04-25 Thread David Malcolm
On Tue, 2017-04-25 at 12:11 -0400, Nathan Sidwell wrote: > On 04/25/2017 11:58 AM, David Malcolm wrote: > > >{ return FIELD; } > > > > for the correct field, favoring returning T to returning T&. > > Hm, that seems the poorer choice (unless you can sug

Re: [PATCH, C++] Fix-it info for typo in nested-name-specifier

2017-04-26 Thread David Malcolm
On Wed, 2017-04-26 at 14:02 +0200, Volker Reichelt wrote: > Hi, > > the following patch adds fix-it information for a diagnostic in the > C++ > parser: Use a scope operator instead of a single colon in a > nested-name-specifier. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > > OK for t

Re: [PATCH] C++: fix-it hints suggesting accessors for private fields

2017-04-26 Thread David Malcolm
On Tue, 2017-04-25 at 18:22 -0400, Nathan Sidwell wrote: > On 04/25/2017 04:01 PM, David Malcolm wrote: > > On Tue, 2017-04-25 at 12:11 -0400, Nathan Sidwell wrote: > > > On 04/25/2017 11:58 AM, David Malcolm wrote: > > > > > > > { return FIELD; } >

[PATCH] C++: Add fix-it hints for -Wold-style-cast

2017-04-27 Thread David Malcolm
Volker's patch for -Wold-style-cast inspired me to add a fix-it hint for when this warning fires, which converts the C-style cast to a C++-style cast. It tries to find a legal C++-style cast, trying them in the order: const_cast, static_cast, reinterpret_cast. It doesn't try dynamic_cast. It cal

[PING] Re: [PATCH 1/2] Port Doxygen support script from Perl to Python; add unittests

2017-04-28 Thread David Malcolm
Ping for these two patches: - https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00909.html - https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00910.html On Thu, 2017-03-16 at 21:51 -0400, David Malcolm wrote: > It's possible to run GCC's sources through Doxygen by setting >

Re: [PATCH] C++ parser: two fix-it hints for broken member declarations

2017-04-29 Thread David Malcolm
On Sat, 2017-04-29 at 19:42 +0200, Volker Reichelt wrote: > Hi, > > the following patch adds fix-it hints to the C++ parser for a stray > comma and a missing semicolon at the end of a member declaration. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > > OK for trunk? OK for trunk Than

[committed] Eliminate fixit_hint class hierarchy

2017-05-01 Thread David Malcolm
The original implementation of fix-it hints (r230674) had an abstract base class "fixit_hint" and three subclasses, representing each of insertions, replacements, and deletions. Having multiple classes for fix-it hints was a nuisance, as it required per-class logic everywhere that the hints were h

[PATCH] RFC: spellchecker for comments, plus -Wfixme and -Wtodo

2017-05-02 Thread David Malcolm
Currently the C/C++ frontends discard comments when parsing. It's possible to set up libcpp to capture comments as tokens, by setting CPP_OPTION (pfile, discard_comments) to false), and this can be enabled using the -C command line option (see also -CC), but c-family/c-lex.c then discards any CPP_C

[committed] Support fix-it hints that add new lines

2017-05-02 Thread David Malcolm
Previously fix-it hints couldn't contain newlines. This is due to the need to print something user-readable for them within diagnostic-show-locus, and for handling them within edit-context for printing diffs and regenerating content. This patch enables limited support for fix-it hints with newlin

[committed] New fix-it printer

2017-05-03 Thread David Malcolm
The existing fix-it printer can lead to difficult-to-read output when fix-it hints are near each other. For example, in a recent patch to add fix-it hints to the C++ frontend's -Wold-style-cast, e.g. for: foo *f = (foo *)ptr->field; ^ the fix-it hints: replace the o

[PATCH v2] C++: Add fix-it hints for -Wold-style-cast

2017-05-03 Thread David Malcolm
On Thu, 2017-04-27 at 23:03 +0200, Marek Polacek wrote: > On Thu, Apr 27, 2017 at 05:10:24PM -0400, David Malcolm wrote: > > + /* First try const_cast. */ > > + trial = build_const_cast (dst_type, orig_expr, 0 /* complain > > */); > > + if (trial != error_mark_node)

[committed] Fix typo in common.opt

2017-05-03 Thread David Malcolm
Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. Committed to trunk as r247562. gcc/ChangeLog: * common.opt (fdiagnostics-parseable-fixits): Fix typo. --- gcc/common.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/common.opt b/gcc/common.opt index 402

[PATCH] c/c++: Add fix-it hints for suggested missing #includes

2017-05-04 Thread David Malcolm
As of r247522, fix-it-hints can suggest the insertion of new lines. This patch uses this to implement a new "maybe_add_include_fixit" function in c-common.c and uses it in the two places where the C and C++ frontend can suggest missing #include directives. [1] The idea is that the user can then c

[PATCH] Fix-it hints for -Wimplicit-fallthrough

2017-05-04 Thread David Malcolm
As of r247522, fix-it-hints can suggest the insertion of new lines. This patch updates -Wimplicit-fallthrough to provide suggestions with fix-it hints, showing the user where to insert "break;" or fallthrough attributes. For example: test.c: In function 'set_x': test.c:15:9: warning: this stat

[PATCH 2/2] Use %H and %I throughout C++ frontend.

2017-05-04 Thread David Malcolm
This is the second half of the kit, which uses %H and %I throughout the C++ frontend whenever describing type mismatches between a pair of %qT. gcc/cp/ChangeLog: * call.c (print_conversion_rejection): Replace pairs of %qT with %H and %I in various places. (build_user_type_c

[PATCH 1/2] C++ template type diff printing

2017-05-04 Thread David Malcolm
This patch kit implements two new options to make it easier to read diagnostics involving mismatched template types: -fdiagnostics-show-template-tree and -fno-elide-type. It adds two new formatting codes: %H and %I which are equivalent to %qT, but are to be used together for type comparisons e

[committed] Fix crash accessing builtins in sanitizer.def and after (PR jit/82174)

2017-09-14 Thread David Malcolm
Calls to gcc_jit_context_get_builtin_function that accessed builtins in sanitizer.def and after (or failed to match any builtin) led to a crash accessing a NULL builtin name. The entries with the NULL name came from these lines in sanitizer.def: /* This has to come before all the sanitizer buil

[PATCH] C++: underline parameters in mismatching function calls

2017-09-20 Thread David Malcolm
When we have a type mismatch in a C++ function call, e.g. extern int callee (int one, const char *two, float three); int caller (int first, int second, float third) { return callee (first, second, third); } we currently emit something like this: test.c: In function 'int caller(int

[PATCH] C++: tweak wording of explicitly-deleted methods

2017-09-20 Thread David Malcolm
When we complain about uses of explicitly-deleted methods, it seems odd to me to refer to "declared here": /usr/include/c++/7/bits/stl_pair.h:292:17: error: use of deleted function 'std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = X; _Dp = std::default_delete]'

[committed] v2: C++: underline parameters in mismatching function calls

2017-09-22 Thread David Malcolm
On Thu, 2017-09-21 at 09:20 -0700, Nathan Sidwell wrote: > On 09/20/2017 12:52 PM, David Malcolm wrote: > > When we have a type mismatch in a C++ function call, e.g. > > whereas underlining the mismatching things would make the messages > > easier to comprehend: > >

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

2017-09-26 Thread David Malcolm
On Mon, 2017-08-28 at 09:22 -0600, Jeff Law wrote: > On 07/03/2017 12:37 PM, David Malcolm wrote: > > This patch improves our C/C++ frontends' handling of missing > > symbols, by making c_parser_require and cp_parser_require use > > "better" locations for the

[PATCH 1/2] C++: avoid partial duplicate implementation of cp_parser_error

2017-09-26 Thread David Malcolm
In r251026 (aka 3fe34694f0990d1d649711ede0326497f8a849dc, "C/C++: show pertinent open token when missing a close token") I copied part of cp_parser_error into cp_parser_required_error, leading to duplication of code. This patch eliminates this duplication by merging the two copies of the code into

[PATCH 2/2] C/C++: add fix-it hints for various missing symbols (v2)

2017-09-26 Thread David Malcolm
The patch improves our C/C++ frontends' handling of missing symbols, by making c_parser_require and cp_parser_require use "better" locations for the diagnostic, and insert fix-it hints, under certain circumstances (see the comments in the patch for full details). For example, for this code with a

[PATCH] C++: show location of problematic extern "C" specifications

2017-09-26 Thread David Malcolm
There are a few places where the C++ FE will complain when attempting to do things within an extern "C" linkage specifier. I've run into problems where it wasn't clear where the pertinent extern "C" was; for example, when failing to close an extern "C" linkage specifier in a header, leading to "te

[committed] jit: implement gcc_jit_function_get_address

2017-09-27 Thread David Malcolm
On Fri, 2017-09-22 at 11:21 +0200, Bartosz Szreder wrote: > Hello David, > > > > 1. The documentation doesn't mention existence of > > > gcc_jit_context_new_function_ptr_type() as a mechanism of > > > handling > > > function pointers, yet contains > > > gcc_jit_context_new_call_through_ptr(). > >

[committed] jit: handle equality of function pointer types

2017-09-28 Thread David Malcolm
libgccjit was being overzealous when type-checking function pointers, requiring exact pointer equality of recording::function_type instances, defeating attempts by client code to work with function pointers as data. This patch removes the overzealous checking, and should allow function pointers to

<    25   26   27   28   29   30   31   32   33   34   >