Author Topic: Ignoring some keywords during tagging  (Read 1581 times)

timur

  • Senior Community Member
  • Posts: 120
  • Hero Points: 0
Ignoring some keywords during tagging
« 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?

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Ignoring some keywords during tagging
« Reply #1 on: December 10, 2014, 05:37:58 pm »
Just add
Code: [Select]
#define __read_mostly to your C/C++ Preprocessing configuration.
HS2

mjdl

  • Senior Community Member
  • Posts: 110
  • Hero Points: 8
  • SlickEdit 2017 Beta 3 x64, Windows 7 SP1 x64
Re: Ignoring some keywords during tagging
« Reply #2 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.

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Ignoring some keywords during tagging
« Reply #3 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 page are still pointing to SE v18 docs.
HS2

timur

  • Senior Community Member
  • Posts: 120
  • Hero Points: 0
Re: Ignoring some keywords during tagging
« Reply #4 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.

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Ignoring some keywords during tagging
« Reply #5 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
« Last Edit: December 10, 2014, 09:23:01 pm by hs2 »

timur

  • Senior Community Member
  • Posts: 120
  • Hero Points: 0
Re: Ignoring some keywords during tagging
« Reply #6 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.
« Last Edit: December 10, 2014, 10:10:11 pm by timur »

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Ignoring some keywords during tagging
« Reply #7 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
« Last Edit: December 10, 2014, 10:13:29 pm by hs2 »

timur

  • Senior Community Member
  • Posts: 120
  • Hero Points: 0
Re: Ignoring some keywords during tagging
« Reply #8 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.