SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: timur on December 10, 2014, 05:26:58 PM

Title: Ignoring some keywords during tagging
Post by: timur on December 10, 2014, 05:26:58 PM
The Linux kernel has lots of code that looks like this:

static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */

The __read_mostly is confusing the tagging tool, because it thinks that __read_mostly is the name of the variable, when it's really pcpu_slot.  How can I fix that?
Title: Re: Ignoring some keywords during tagging
Post by: hs2 on December 10, 2014, 05:37:58 PM
Just add
Code: [Select]
#define __read_mostly to your C/C++ Preprocessing configuration.
HS2
Title: Re: Ignoring some keywords during tagging
Post by: mjdl on December 10, 2014, 05:53:46 PM
One thing I hadn't ever picked up from reading the manual, is that in addition to adding user-specified C/C++ macros via the Options dialog or a usercpp.h file in the user config folder, it's also possible to to use a specific [workspace-name]_cpp.h file in the workspace folder. Very nice, is this feature new with v19?--I obviously have to pay more attention to the manual.
Title: Re: Ignoring some keywords during tagging
Post by: hs2 on December 10, 2014, 07:34:32 PM
@mjdl: Never mind - it's a new and very appreciated feature of SE v19. It was first announced the beta/RC release notes.
@SlickTeam: The links of the SlickEdit Product Documentation (http://www.slickedit.com/products/slickedit/product-documentation) page are still pointing to SE v18 docs.
HS2
Title: Re: Ignoring some keywords during tagging
Post by: timur on December 10, 2014, 08:21:14 PM
Just add
Code: [Select]
#define __read_mostly to your C/C++ Preprocessing configuration.
HS2
Sorry, where is that?  I'm using SlickEdit v16.
Title: Re: Ignoring some keywords during tagging
Post by: hs2 on December 10, 2014, 09:21:30 PM
It's existing much, much longer than v16 ;)
I guess (not having v16 installed anymore) you've to:
- Tools > Options > File Extension setup: select Extension 'c', 'cpp' or something else associated with 'C/C++'
- click 'C/C++ Options' button at the bottom of the dialog
- select 'Other' tab of the 'C/C++ Formatting Options' dialog
- click the 'C/C++ Preprocessing' button
- click 'New' to add the '#define __read_mostly' macro
Done :)

With this kind of macro (used by the SE tagging engine) all __read_mostly occurences are internally replaced with <nothing> by the SE tagging engine while parsing your sources exactly like the preprocessor of your C compiler.
You might need to retag your (workspace) tagfiles after doing so if it's done automatically by SE.
See also: 'Help>Index: preprocessing' for documentation

Good luck, HS2
Title: Re: Ignoring some keywords during tagging
Post by: timur on December 10, 2014, 10:04:12 PM
Doesn't this set the option for all C/C++ projects?  I only need it for some projects.

Anyway, when I try this, it recognizes __read_mostly as a C macro already.  I set it to blank, and this does seem to work.  Thanks.
Title: Re: Ignoring some keywords during tagging
Post by: hs2 on December 10, 2014, 10:11:22 PM
As mentioned before since v19 it's optionally per workspace (tagfile).
In prev. versions it's a global configuration indeed and you'd have to manage it manually.
Either as descriped using the UI or dealing with the resulting '<SE config dir>/usercpp.h' file.
But in your case it doesn't really matter, right ?
HS2
Title: Re: Ignoring some keywords during tagging
Post by: timur on December 10, 2014, 10:13:17 PM
Yeah, it should be okay, and it will allow me to work with multiple kernel projects, so nothing else defines that macro.