[PATCH] semantic/bovine: parse C++ override functions correctly

Ramkumar Ramachandra <[email protected]> Sat, 17 Jan 2015 17:34:26 -0500
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
"override" is a perfectly good opt-post-fcn-modifiers in C++. Parse it
correctly.

Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
 The red lines under override functions were really annoying. Here's a
 patch to fix that.

 lisp/cedet/semantic/bovine/c.by     | 3 +++
 lisp/cedet/semantic/bovine/c.el     | 2 ++
 tests/cedet/semantic/tests/test.cpp | 6 ++++++
 3 files changed, 11 insertions(+)

diff --git a/lisp/cedet/semantic/bovine/c.by b/lisp/cedet/semantic/bovine/c.by
index e4214b4..ac4b83c 100644
--- a/lisp/cedet/semantic/bovine/c.by
+++ b/lisp/cedet/semantic/bovine/c.by
@@ -140,6 +140,8 @@
 %put THROW summary "<type> <methoddef> (<method args>) throw (<exception>) ..."
 %token REENTRANT "reentrant"
 %put REENTRANT summary "<type> <methoddef> (<method args>) reentrant ..."
+%token OVERRIDE "override"
+%put OVERRIDE summary "<type> <methoddef> (<method args>) override ..."
 %token TRY "try"
 %token CATCH "catch"
 %put { TRY CATCH } summary "try { <body> } catch { <catch code> }"
@@ -844,6 +846,7 @@ opt-post-fcn-modifiers
 post-fcn-modifiers
   : REENTRANT
   | CONST
+  | OVERRIDE
   ;
 
 opt-throw
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 8592400..ff62fd5 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1352,6 +1352,8 @@ Optional argument STAR and REF indicate the number of * and & in the typedef."
 	    :throws (nth 5 tokenpart)
 	    ;; Reentrant is a C++ thingy.  Add it here
 	    :reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t)
+	    ;; override is a C++ thingy.  Add it here
+	    :override-flag (if (member "override" (nth 6 tokenpart)) t)
 	    ;; A function post-const is funky.  Try stuff
 	    :methodconst-flag (if (member "const" (nth 6 tokenpart)) t)
 	    ;; prototypes are functions w/ no body
diff --git a/tests/cedet/semantic/tests/test.cpp b/tests/cedet/semantic/tests/test.cpp
index 8a00c6b..2926baf 100644
--- a/tests/cedet/semantic/tests/test.cpp
+++ b/tests/cedet/semantic/tests/test.cpp
@@ -161,6 +161,12 @@ void *class3::method5_for_class3( int a, int b) const
 {
 }
 
+void *class3::method6_for_class3( int a, int b) override
+{
+  int q = a;
+  return "Moose";
+}
+
 /*
  * Namespace parsing tests
  */
-- 
2.2.1


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet