ualberta-smr / varclang

Mirror of official clang git repository located at http://llvm.org/git/clang. Updated every five minutes.
http://clang.llvm.org/
Other
3 stars 2 forks source link

Add SAT check when entering an #if/#ifdef #1

Open mayshukla opened 5 years ago

mayshukla commented 5 years ago

The parser (maybe the preprocessor?) should check for unreachable blocks. These would have unsatisfiable presence conditions. Then, the parser will not create redundant declarations.

For example:

#ifdef A
  #ifndef A
    int i = 0; // unreachable
  #endif
#endif
mayshukla commented 5 years ago

Also, issue a diagnostic saying that there is unreachable code. If this diagnostic could be enabled/disabled optionally that would be ideal.

mayshukla commented 5 years ago

This should be done in the preprocessor