This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] C++ FE: handle misspelled identifiers and typenames


On Thu, Jul 21, 2016 at 7:23 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Thu, 2016-07-21 at 10:38 -0400, David Malcolm wrote:
>> On Thu, 2016-07-21 at 10:28 -0400, David Malcolm wrote:
>> > On Thu, 2016-07-21 at 09:00 +0200, Uros Bizjak wrote:
>> > > Hello!
>> > >
>> > > > > gcc/ChangeLog:
>> > > > > PR c/70339
>> > > > > * diagnostic-show-locus.c (diagnostic_show_locus): If this is
>> > > > > the
>> > > > > same location as last time, don't skip if we have fix-it
>> > > > > hints.
>> > > > > Clarify the skipping logic by converting it from one "if"
>> > > > > clause
>> > > > > to repeated "if" clauses.
>> > > > > * spellcheck-tree.c: Include "cpplib.h".
>> > > > > (find_closest_macro_cpp_cb): Move here from c/c-decl.c.
>> > > > > (best_macro_match::best_macro_match): New constructor.
>> > > > > * spellcheck-tree.h (struct edit_distance_traits<cpp_hashnode
>> > > > > *>):
>> > > > > Move here from c/c-decl.c.
>> > > > > (class best_macro_match): Move here from c/c-decl.c,
>> > > > > converting
>> > > > > from a typedef to a subclass, gaining a ctor.
>> > >
>> > > This part introduced bootstrap failure on CentOS 5.11:
>> > >
>> > > g++ -std=gnu++98 -fno-PIE -c   -g  -DIN_GCC    -fno-strict
>> > > -aliasing
>> > > -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
>> > > -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format
>> > > -attribute
>> > > -Woverloaded-virtual -fno-common  -DHAVE_CONFIG_H -I. -I.
>> > > -I../../git/gcc/gcc -I../../git/gcc/gcc/.
>> > > -I../../git/gcc/gcc/../include
>> > > -I../../git/gcc/gcc/../libcpp/include
>> > > -I/usr/local/include -I/usr/local/include -I/usr/local/include
>> > > -I../../git/gcc/gcc/../libdecnumber
>> > > -I../../git/gcc/gcc/../libdecnumber/bid -I../libdecnumber
>> > > -I../../git/gcc/gcc/../libbacktrace   -o spellcheck-tree.o -MT
>> > > spellcheck-tree.o -MMD -MP -MF ./.deps/spellcheck-tree.TPo
>> > > ../../git/gcc/gcc/spellcheck-tree.c
>> > > ../../git/gcc/gcc/spellcheck-tree.c: In constructor
>> > > ‘best_macro_match::best_macro_match(tree_node*, edit_distance_t,
>> > > cpp_reader*)’:
>> > > ../../git/gcc/gcc/spellcheck-tree.c:94: error: class
>> > > ‘best_macro_match’ does not have any field named ‘best_match’
>> > > ../../git/gcc/gcc/spellcheck-tree.c:94: error: no matching
>> > > function
>> > > for call to ‘best_match<tree_node*, cpp_hashnode*>::best_match()’
>> > > ../../git/gcc/gcc/spellcheck.h:91: note: candidates are:
>> > > best_match<GOAL_TYPE, CANDIDATE_TYPE>::best_match(GOAL_TYPE,
>> > > edit_distance_t) [with GOAL_TYPE = tree_node*, CANDIDATE_TYPE =
>> > > cpp_hashnode*]
>> > > ../../git/gcc/gcc/spellcheck.h:81: note:
>> > > best_match<tree_node*, cpp_hashnode*>::best_match(const
>> > > best_match<tree_node*, cpp_hashnode*>&)
>> > > gmake: *** [spellcheck-tree.o] Error 1
>> > >
>> > > CentOS 5 has pretty old system compiler [gcc version 4.1.2
>> > > 20080704
>> > > (Red Hat 4.1.2-55)], but the build worked until the above patch
>> > > was
>> > > committed. Is it possible to work around this failure somehow?
>> >
>> > Sorry about the breakage.
>> >
>> > I've now built a gcc 4.1 locally, and with that I can reproduce the
>> > issue.  Am investigating...
>>
>> The following patch seems to fix it; successfully compiles that file
>> with my local builds of gcc 7 and gcc 4.1 (and with Fedora system gcc
>> 4.8.3).
>>
>> Does it fix the build for you?
>>
>> Bootstrap&regrtesting underway here.
>>
>> gcc/ChangeLog:
>>       * spellcheck-tree.c (best_macro_match::best_macro_match):
>>       Explicitly specify the template arguments when invoking the
>> base
>>       class constructor, to help older C++ compilers.
>>
>> Sorry again about the breakage.
>
> This patch survived bootstrap&regrtest, and compiles and runs OK with
> gcc-4.1, so I've committed it to trunk as r238598 (under the "obvious"
> rule).
>
> Please let me know if there are any configurations for which it still
> doesn't work.

Yes, the patch solves bootstrap problem for me.

Thanks!

Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]