https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65834

            Bug ID: 65834
           Summary: give error for #if with no expression at the previous
                    location
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

Distilled from:
http://www.linuxquestions.org/questions/linux-from-scratch-13/replace-gcc-with-clang-4175491981/#post5108443

extern void foo(void);
#define TEST

int bar(void)
{
#if TEST
  foo();
#endif
  return 0;
}

Currently:

test.c:6:9: error: #if with no expression
 #if TEST
         ^

Expected something like:

test.c:6:9: error: #if with no expression
 #if TEST
     ^
test.c:2:14: note: in expansion of macro ‘TEST’

I think this could be possible by giving the error at the location of TEST
(which should be the previously encoded source_location) rather that at the
current one.

 #define TEST 
              ^

Reply via email to