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)

alk
  • 69,737
  • 10
  • 105
  • 255
cleong
  • 7,242
  • 4
  • 31
  • 40

1 Answers1

1

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

Eugene
  • 9,242
  • 2
  • 30
  • 29
  • There already is an entry referring this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=84144 Could perhaps someone clarify what the comments on this bug report want to say? – alk Sep 21 '12 at 10:11
  • 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. – cleong Sep 21 '12 at 11:35
  • @cleong Have you been succesfull with turning of such feature. I am facing the same problem. Situation did not changed in CDT over time. – Mihalko Apr 22 '14 at 11:00
  • @Mihalko. Nope. Have to turn off syntax checking altogether. – cleong Apr 22 '14 at 13:11