How to stop Eclipse CDT from emitting errors due to gcc specific syntax?
Asked Answered
P

1

8

I'm writing some code that makes use of computed goto. The syntax checker is flagging every instance of goto *ptr and &&label as syntax error. Is there anyway to stop this?

Addition by alk:

Example for computed gotos (gcc extension):

...

void * pLbl = NULL;

if (<some expression>)
  pLbl = &&lbl1;  /* gcc extension: no, '&&' is not a typo */
else if (<some other expression>)
  pLbl = &&lbl2;  /* gcc extension: no, '&&' is not a typo */

if (pLbl)
  goto * pLbl;  /* gcc extension: goes/jumps to either 'lbl1' or 'lbl2' */

goto lbl0;

lbl1:
  <do some stuff>
goto lbl0;

lbl2:
  <do some other stuff>
goto lbl0;

lbl0:

...

(eclipse seeing this code gets yellow all over)

Pilau answered 20/9, 2012 at 10:1 Comment(3)
Put some code please, I don't understand the question.Peristalsis
I wonder why this was voted down. Is it considered of topic here? It is good style to leave a comment if down voting, isn't it?Monophyletic
Example added for better understanding ... @JulienFouilhéMonophyletic
V
1

No way other then filing a bug to the CDT bugtracker, preferably with a patch for the parser.

Visibility answered 21/9, 2012 at 0:19 Comment(4)
There already is an entry referring this: bugs.eclipse.org/bugs/show_bug.cgi?id=84144 Could perhaps someone clarify what the comments on this bug report want to say?Monophyletic
The original report was filed in...Feb 2005. The chance of this getting fixed doesn't look good. I'm just going to turn off the feature. It's giving me other spurious warnings as well. I'm having trouble doing that though. I unchecked all the checkboxes in Preference > C/C++ > Code Analysis and the darn errors are still popping up.Pilau
@Pilau Have you been succesfull with turning of such feature. I am facing the same problem. Situation did not changed in CDT over time.Sedgewake
@Mihalko. Nope. Have to turn off syntax checking altogether.Pilau

© 2022 - 2024 — McMap. All rights reserved.