c++ - Clang line directive -


i'm writing syntax translator outputs c++ code , have run interesting issue. have 2 files: ln.x , ln.cpp. in ln.x:

abc 

in ln.cpp:

#line 1 "ln.x" ( 

when try compile using gcc, prints corresponding line in ln.x:

ln.x:1:1: error: expected unqualified-id @ end of input  abc  ^ ln.x:1:1: error: expected ‘)’ @ end of inpu 

however, clang prints line of same file:

ln.x:1:2: error: expected unqualified-id (  ^ ln.x:1:2: error: expected ')' ln.x:1:1: note: match '(' ( ^ 2 errors generated. 

is there way clang print line of file gcc?

this looks more bug feature. why want it?

printing file nominated #line works long line matches text getting parsed, character-for-character. , if file exists in first place.

i don’t see in gcc preprocessor manual (gcc 4.9 edition). however, there note once upon time (up 2001), gcc assume named file existed locally, or @ least parent directory existed. holdover bug.

and, no, there's no way clang this. has no concept of attempting open file named #line.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -