[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C-mode: how to ignore certain tokens (sometimes)
From: |
Alan Mackenzie |
Subject: |
Re: C-mode: how to ignore certain tokens (sometimes) |
Date: |
Mon, 29 Dec 2014 18:21:36 +0000 (UTC) |
User-agent: |
tin/2.2.0-20131224 ("Lochindaal") (UNIX) (FreeBSD/8.4-RELEASE (amd64)) |
Hello, ?scar.
?scar Fuentes <ofv@wanadoo.es> wrote:
> One common idiom in C++ is
> class DECORATION foo {
> ...
> where DECORATION acts as an attribute to be applied to the class being
> defined. One example is __dllexport (Windows) or __attribute__
> ((visibility("default"))) (GNU/Linux). Usually it is a macro that
> expands to some compiler/platform-specific decoration.
> The problem is that the presence of DECORATION confuses C-mode and it
> makes bad guesses of some of the elements. For instance:
> struct EXPORT foo {
> public:
> foo(int d)
> : data()
> {}
> The colon that precedes `data' is interpreted as `statement-cont' when
> it should be `member-init-intro'.
> It there a way to tell C-mode that certain tokens should be ignored
> while doing the analysis required by the indentation engine?
Not at the moment, no. I have a half-tested enhancement "noise macros"
to CC Mode, a bit like the existing "macros with semicolons", designed to
address precisely this problem. I foresee releasing it early in 2015.
Have a happy New Year!
--
Alan Mackenzie (Nuremberg, Germany).