unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
@ 2016-08-16 20:54 Arash
  2016-08-17 12:29 ` Alan Mackenzie
  2016-08-17 18:21 ` Alan Mackenzie
  0 siblings, 2 replies; 7+ messages in thread
From: Arash @ 2016-08-16 20:54 UTC (permalink / raw)
  To: 24246

$ emacs -Q ab.cc

typedef int int32;

namespace wrapper {
    enum type { a, b, c };
}

// int32 doesn't get highlighted as a type.
void test(wrapper::type A, int32 B);


typedef wrapper::type wtype;

// here it works, so double colon is the problem?
void test(wtype A, int32 B);





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-16 20:54 bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument Arash
@ 2016-08-17 12:29 ` Alan Mackenzie
  2016-08-17 18:21 ` Alan Mackenzie
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2016-08-17 12:29 UTC (permalink / raw)
  To: Arash; +Cc: 24246

Hello, Arash.

On Wed, Aug 17, 2016 at 01:24:17AM +0430, Arash wrote:
> $ emacs -Q ab.cc

> typedef int int32;

> namespace wrapper {
>     enum type { a, b, c };
> }

> // int32 doesn't get highlighted as a type.
> void test(wrapper::type A, int32 B);


> typedef wrapper::type wtype;

> // here it works, so double colon is the problem?
> void test(wtype A, int32 B);

Yes, it looks like the double colon exposes the problem.  I'll look into
it soon.

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-16 20:54 bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument Arash
  2016-08-17 12:29 ` Alan Mackenzie
@ 2016-08-17 18:21 ` Alan Mackenzie
  2016-08-17 20:03   ` Arash
  2016-09-08 15:18   ` Arash
  1 sibling, 2 replies; 7+ messages in thread
From: Alan Mackenzie @ 2016-08-17 18:21 UTC (permalink / raw)
  To: Arash; +Cc: 24246

Hello again, Arash.

On Wed, Aug 17, 2016 at 01:24:17AM +0430, Arash wrote:
> $ emacs -Q ab.cc

> typedef int int32;

> namespace wrapper {
>     enum type { a, b, c };
> }

> // int32 doesn't get highlighted as a type.
> void test(wrapper::type A, int32 B);


> typedef wrapper::type wtype;

> // here it works, so double colon is the problem?
> void test(wtype A, int32 B);

Thanks indeed for this bug report, and thanks even more for cutting it
down to a nice, crisp, manageable file.

The fontification code was not handling "::" in declarations correctly.
I think I have corrected this, and I have committed it to our master
branch at savannah.

I see you're on the emacs-25 branch.  Could you please patch your Emacs
with the following patch (the file is in directory .../lisp/progmodes),
rebuild CC Mode (a single $ emacs -Q -batch -f batch-byte-compile
.../lisp/progmodes/cc-engine.el should suffice), reload CC Mode into
your Emacs (or restart Emacs), then try out the new system on your real
code.

Then please let me know whether the problem has been truly fixed, and
if not, what is still wrong.  If everything is OK, I will close the bug.

Here's the patch:



# HG changeset patch
# User Alan Mackenzie <acm@muc.de>
# Date 1471456447 0
#      Wed Aug 17 17:54:07 2016 +0000
# Node ID 85afa8e79cc145c4ab61d8c8f180587d85c71bec
# Parent  0e89dd90ade9cd6f5f4ca07cb57cba6f8e1335a5
Fontify constructs following "::" in C++ argument lists correctly.

This fixes bug #24246.

* cc-engine.el (c-find-decl-prefix-search): In the "pseudo match" loop, test a
found string for a match with c-opt-identifier-concat-key (e.g. with "::").

* arglist-23.{cc,face}: New test files.

diff -r 0e89dd90ade9 -r 85afa8e79cc1 cc-engine.el
--- a/cc-engine.el	Wed Aug 17 17:53:10 2016 +0000
+++ b/cc-engine.el	Wed Aug 17 17:54:07 2016 +0000
@@ -5171,6 +5171,13 @@
 			(and (< (point) cfd-limit)
 			     (c-got-face-at (point) c-literal-faces))))
 	       t)		      ; Continue the loop over pseudo matches.
+	      ((and c-opt-identifier-concat-key
+		    (match-string 1)
+		    (save-excursion
+		      (goto-char (match-beginning 1))
+		      (looking-at c-opt-identifier-concat-key)))
+	       ;; Found, e.g., "::" in C++
+	       t)
 	      ((and (match-string 1)
 		    (string= (match-string 1) ":")
 		    (save-excursion


-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-17 18:21 ` Alan Mackenzie
@ 2016-08-17 20:03   ` Arash
  2016-08-18  9:49     ` Alan Mackenzie
  2016-08-23 22:34     ` Michael Welsh Duggan
  2016-09-08 15:18   ` Arash
  1 sibling, 2 replies; 7+ messages in thread
From: Arash @ 2016-08-17 20:03 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 24246

Thanks, fontification for function decs/defs got fixed but the problem
still exists in e.g. init step of a for loop...

for (wrapper::type a = 0, int32 b = 0; ; ) {
    ...
}





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-17 20:03   ` Arash
@ 2016-08-18  9:49     ` Alan Mackenzie
  2016-08-23 22:34     ` Michael Welsh Duggan
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2016-08-18  9:49 UTC (permalink / raw)
  To: Arash, 24246-done

Hello, Arash.

On Thu, Aug 18, 2016 at 12:33:33AM +0430, Arash wrote:
> Thanks, fontification for function decs/defs got fixed but the problem
> still exists in e.g. init step of a for loop...

> for (wrapper::type a = 0, int32 b = 0; ; ) {
>     ...
> }

This is actually a different bug - if you delete the "::", the problem
is still there.  I've submitted bug #24258 for this problem, and I'm
working on it.

I'm closing the original bug now, since it appears to be fixed.

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-17 20:03   ` Arash
  2016-08-18  9:49     ` Alan Mackenzie
@ 2016-08-23 22:34     ` Michael Welsh Duggan
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Welsh Duggan @ 2016-08-23 22:34 UTC (permalink / raw)
  To: Arash; +Cc: Alan Mackenzie, 24246

Arash <pbqbqp@gmail.com> writes:

> Thanks, fontification for function decs/defs got fixed but the problem
> still exists in e.g. init step of a for loop...
>
> for (wrapper::type a = 0, int32 b = 0; ; ) {
>     ...
> }

I don't believe that is legal C++.  The for-init-statement must be a
single statement.  Since "wrapper::type a = 0, int32 b = 0;" is not a
legal statement, it is not a legal for-init-statement.

The following, however, is legal:

  for (struct{wrapper::type a; int32 b;} var = {0, 0}; ; ) {
  
  }

-- 
Michael Welsh Duggan
(md5i@md5i.com)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument.
  2016-08-17 18:21 ` Alan Mackenzie
  2016-08-17 20:03   ` Arash
@ 2016-09-08 15:18   ` Arash
  1 sibling, 0 replies; 7+ messages in thread
From: Arash @ 2016-09-08 15:18 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 24246

Alan Mackenzie wrote:

> Hello again, Arash.
>
> On Wed, Aug 17, 2016 at 01:24:17AM +0430, Arash wrote:
>> $ emacs -Q ab.cc
>
>> typedef int int32;
>
>> namespace wrapper {
>>     enum type { a, b, c };
>> }
>
>> // int32 doesn't get highlighted as a type.
>> void test(wrapper::type A, int32 B);
>
>
>> typedef wrapper::type wtype;
>
>> // here it works, so double colon is the problem?
>> void test(wtype A, int32 B);
>
> Thanks indeed for this bug report, and thanks even more for cutting it
> down to a nice, crisp, manageable file.
>
> The fontification code was not handling "::" in declarations correctly.
> I think I have corrected this, and I have committed it to our master
> branch at savannah.
>
> I see you're on the emacs-25 branch.  Could you please patch your Emacs
> with the following patch (the file is in directory .../lisp/progmodes),
> rebuild CC Mode (a single $ emacs -Q -batch -f batch-byte-compile
> .../lisp/progmodes/cc-engine.el should suffice), reload CC Mode into
> your Emacs (or restart Emacs), then try out the new system on your real
> code.
>
> Then please let me know whether the problem has been truly fixed, and
> if not, what is still wrong.  If everything is OK, I will close the bug.

Hi Alan. This is a bit late, sry.

// Here, first double colon causes the same problem.
void test(::base::string S, int32 test)
{ }

// and here, even "string" doesn't get highlighted.
void test(::base::string &S)
{ }





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-08 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 20:54 bug#24246: 25.0.95; (c++-mode) custom/extra types not getting highlighted (as a type) after a wrapper::type argument Arash
2016-08-17 12:29 ` Alan Mackenzie
2016-08-17 18:21 ` Alan Mackenzie
2016-08-17 20:03   ` Arash
2016-08-18  9:49     ` Alan Mackenzie
2016-08-23 22:34     ` Michael Welsh Duggan
2016-09-08 15:18   ` Arash

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).