Bug 391799 - Code syntax check only in active code
Summary: Code syntax check only in active code
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 510478
  Show dependency tree
 
Reported: 2012-10-12 10:50 EDT by Marko Tomljenovic CLA
Modified: 2020-09-04 15:23 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Tomljenovic CLA 2012-10-12 10:50:09 EDT
There is a source code syntax check available that creates markers in the editor ruler for syntax errors (e.g. when a clamp is missing).

This check seems to work only on active code. But such a low level check should also be available on inactive code.
Comment 1 Nathan Ridge CLA 2014-10-16 01:27:11 EDT
This is not as simple as it sounds, because whether or not something is a syntax error can depend on declarations in previous inactive blocks. Consider:

  #ifdef FOO
      #define SOME_MACRO __attribute__((something))
  #endif

  // later

  #ifdef FOO
      #define BAR
  #endif

  // yet later

  #ifdef BAR
      int SOME_MACRO x;
  #endif

Here, to accurately determine that the line

  int SOME_MACRO x;

is not a syntax error, CDT would have to parse the whole file in two contexts: once with 'FOO' defined, and once with 'FOO' not defined.

In general, if there are 'n' macros that are used in conditional compilation of a file, CDT would need to parse the file 2^n times (more if the macros can have values other than just defined / not defined). This doesn't scale.
Comment 2 Nathan Ridge CLA 2014-11-01 02:44:02 EDT
See also bug 389219, which proposes to index inactive code branches.