Support for linemarkers
Do you plan to add linemarkers to the output, as described in https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html ?
The first sentence on that page says: "When the C preprocessor is used with the C, C++, or Objective-C compilers, it is integrated into the compiler and communicates a stream of binary tokens directly to the compiler’s parser."
The textual output from simplecpp is only meant for debugging right now.
Would you be interested to use simplecpp for something and don't want to use the binary interface?
Hello Daniel
I use simplecpp in the IDL compiler: https://github.com/nirvanaos/idlfe In the IDL compilation, it is important to know the location, where the particular file was included. The #line directives do not provide enough information for this. This is the cause of why I need the line markers.
With best regards Igor Popov
пт, 12 мар. 2021 г. в 18:44, Daniel Marjamäki @.***>:
The first sentence on that page says: "When the C preprocessor is used with the C, C++, or Objective-C compilers, it is integrated into the compiler and communicates a stream of binary tokens directly to the compiler’s parser."
The textual output from simplecpp is only meant for debugging right now.
Would you be interested to use simplecpp for something and don't want to use the binary interface?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danmar/simplecpp/issues/208#issuecomment-797572498, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBWOZNL3U72V2UWVA5XUT3TDIZGLANCNFSM4Y75XPHA .
I feel that you should use simplecpp as a lexer and replace your scanner.ll file. The debug output is not 100% accurate so sooner or later I fear that you will run into some more problem.. for instance:
#define A 1234
A = 1;
debug output:
1234 = 1;
So "= 1;" has been moved on the line. The equal used to be on column 3 but in the debug output it is on column 6. In the raw token output the location is "3". So if you want to write some warning message like:
test1.c:2:3: error: you cant assign a number
A = 1;
^-- here
then you can't rely on the debug output.
I also have the feeling that expanded macros might not be shown "properly" in all cases but I can't give an example off the top of my head.
Hi Daniel No, I don't plan to replace Flex lexer. I just use stringify() as input for Flex. Currently, after adding the linemarkers (see my pull request https://github.com/danmar/simplecpp/pull/213), the simplecpp output looks acceptable for me.
ср, 17 мар. 2021 г. в 13:42, Daniel Marjamäki @.***>:
I feel that you should use simplecpp as a lexer and replace your scanner.ll file. The debug output is not 100% accurate so sooner or later I fear that you will run into some more problem.. for instance:
#define A 1234 #define B 5678 A B
output:
1234 5678
So "5678" has been moved on the line. It used to be a macro on column 3 but the value is put on column 6. In the raw token output the location is "3". So if you want to write some warning message like:
test1.c:3:3: warning: some warning text: A B ^-- here
then you can't rely on the debug output.
I also have the feeling that expanded macros might not be shown "properly" in all cases but I can't give an example off the top of my head.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danmar/simplecpp/issues/208#issuecomment-800979781, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBWOZLUKYFRUK4LI4PXGRTTECBR5ANCNFSM4Y75XPHA .
ok well it's not a huge deal for me.. unless you start bumping into problems and want to fix the debug output..
I am happy to have one more user for simplecpp. :+1: