-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ final keyword in method definition #3952
Comments
Thank you for reporting. I read https://en.cppreference.com/w/cpp/language/final. It seems that the final keyword can be used in class or struct definition.
This method definition is at the top level. Is this correct C++ code? |
If the final keyword is used inside a struct, it is recorded in
|
Hello, Thank for your fast response. I didn't include any include file or further explanations, so here they are FILE_IO is a class that is defined in another class PIFC My prototyping program uses the ctags outputs from source files and include files At compilation stage, as PUBLIC, IN, FINAL and OVERRIDE are empty macros, the source file compiles successfully foo.cpp
pifc.h
Kind regards, |
I'm not sure I understand what you want. As a principle of u-ctags design, ctags works only for valid input. If you pass -DFINAL=final -DOVERRIDE=override, ctags sees:
as input. As an input of C++ language, using the final and override keywords with a method implementation is not allowed as far as my C++ knowledge. (Fix me if I'm incorrect.) For such an invalid input, the behavior of ctags is predictable. Give me time. I will show my idea. |
Hello Masatake, Cppreference.com (https://en.cppreference.com/w/cpp/language/final) exhibits
As I explained before, my exemple works with OVERRIDE and ctags shows the override property.
should show
BUT, in fact, you are right, final and override keywords are ONLY allowed in class definitions
|
Hello again, I think I have a clue
to ease the process, consider the following options file
Running
the ctags output for methods is
the final and override properties are shown. If I commented out, classes definitions at the top
The final property doesn't appear. Only the override property is shown. Kind regards, |
This looks bug. As you wrote:
It seems that not only the final keyword but also the override keyword should be rejected. |
Hello again, That's OK for me. Have a nice day Kind regards, |
Adding
In this example, I defined mytool.ctags:
|
|
Wahou, very impressive ! What language is this ? it's a sort of mix between FORTH and postscript... |
I call it optscript mostly derived from postscript. It is not documented yet and is immature. |
You are interested in
|
I remembered I wrote about optscript a bit: https://docs.ctags.io/en/latest/optscript.html |
Thank you for these informations, I will take a look. Kind regards, |
(
The final C++ keyword is handled at class level as well as inlined methods in the class ; it appears as a property.
In my case, I use ctags for extracting definitions from source files to inject them in classes for declarations.
The override keyword is handled as a property but not final.
Is it possible to add it ?
Kind regards,
Patrice.
)
The name of the parser: C++
The command line you used to run ctags:
The content of input file:
The tags output you are not satisfied with:
The tags output you expect:
The version of ctags:
How do you get ctags binary:
(
Building it locally, Microsoft Visual C++ 2013, from github
$ git log -1
commit 38fd8e3 (HEAD -> master, tag: p6.1.20240310.0, origin/master, origin/HEAD)
Merge: 45f200c c433018
Author: Masatake YAMATO [email protected]
Date: Sat Mar 9 10:15:16 2024 +0900
)
The text was updated successfully, but these errors were encountered: