-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preprocessor #273
Preprocessor #273
Conversation
Review status: 10 of 26 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. a discussion (no related file): Previously, elliotchance (Elliot Chance) wrote…
Cleaning output Go code, see #232 ast/ast.go, line 257 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. preprocessor/parse_include_preprocessor_line.go, line 12 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
No need. It is always start from symbol "#" program/function_definition.go, line 170 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
With tests/enum.c, line 10 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Change for avoid intersection with constants from tests/enum.c, line 38 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Change for avoid intersection with constants from Comments from Reviewable |
Review status: 10 of 26 files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. transpiler/operators.go, line 73 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done tests/math.c, line 14 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. Comments from Reviewable |
PR ready for review.Before review - Please see #232. |
Reviewed 2 of 5 files at r3, 1 of 8 files at r5, 3 of 9 files at r6, 11 of 14 files at r7, 5 of 5 files at r8. ast/ast_test.go, line 44 at r8 (raw file):
Can you also check the value of linux/ctype.go, line 92 at r8 (raw file):
Why do these need to be implemented now? Can they not be understood from parsing the header files? noarch/ctype.go, line 4 at r8 (raw file):
I understand that these come from program/function_definition.go, line 170 at r5 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
I see you reverted the change. Does that mean that program/function_definition.go, line 78 at r8 (raw file):
Always use single line comments program/function_definition.go, line 93 at r8 (raw file):
There were tests before that used these functions. Why were they working before and now they need to be implemented in Go? Generally we want to avoid implementing any C stdlib functions. Only functions that are so low level they cannot be understood by the headers. Otherwise we are not being true to a transpiler and we will have to implement many functions that work differently on different platforms. tests/enum.c, line 10 at r5 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
I see - if they belong to stdio you should be able to remove them and the test still passes? transpiler/variables.go, line 52 at r8 (raw file):
Once again, why has the implementation of these changed? types/cast.go, line 72 at r8 (raw file):
Why can't it register these types from the header? There would be many more types that could exist. Comments from Reviewable |
Review status: 27 of 30 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. ast/ast_test.go, line 44 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Now, format of output in value linux/ctype.go, line 92 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
No. Preprocessor anf transpiler are sync to avoid parsing the header files. That way help to easy create external API of header without transpilation of deep structure. noarch/ctype.go, line 4 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
see upper. program/function_definition.go, line 170 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Yes, I found more better solution - add in types list : types/resolve.go program/function_definition.go, line 78 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. program/function_definition.go, line 93 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
see upper. tests/enum.c, line 10 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
No. User code is cannot have variables with same name like in system header. transpiler/variables.go, line 52 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Please see my first comment in that review. types/cast.go, line 72 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Now, found better have - move to Comments from Reviewable |
Review status: 27 of 30 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. linux/ctype.go, line 92 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
One more point - if we use argument Comments from Reviewable |
Review status: 27 of 30 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. linux/ctype.go, line 92 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
For example - we can see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf ISO/IEC 9899 on page detail of implementation <stdlib.h>, but deep inside structure platform depended. Comments from Reviewable |
Review status: 27 of 30 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. linux/ctype.go, line 92 at r8 (raw file):
One more point - if we use argument c2go transpile -keep-unused ... then all will work like in past with add system structures, constants and ... in output Go code. Comments from Reviewable |
Reviewed 7 of 7 files at r9. ast/ast_test.go, line 44 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
You could match part of the output with a substring, or perhaps use a regexp to match part of the start/middle/end? Basically you want to prove that if linux/ctype.go, line 92 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
This is not an acceptable solution. You are correct that header files can be very different, that's exactly why they need to be understood by the transpiler. The output programs have to work as the original compiler intended, and not based of a separate spec. The main point is that c2go should work exactly the same with Maybe take a step back and think about how you can remove unused entities only after the full Go AST has been generated (without changing anything before that point). Comments from Reviewable |
Review status: 24 of 30 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. ast/ast_test.go, line 44 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Add one more checking. linux/ctype.go, line 92 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
In my point of view , all entities from system headers must be in package Comments from Reviewable |
Review status: 23 of 30 files reviewed at latest revision, 2 unresolved discussions, some commit checks broke. linux/ctype.go, line 92 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
Or : I can change my design of Preprocessor for solving problem with dublicate of system header and remove all about Comments from Reviewable |
Reviewed 1 of 7 files at r10. linux/ctype.go, line 92 at r8 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
The misunderstanding might be what system headers actually are. There is nothing special about system headers, they work exactly the same as any other source file that exists. c2go is a transpiler, not an abstraction layer or interpreter. Just like the clang compiler itself it does not differentiate where functions are defined. There are only two cases when functions must be implemented in
Removing the unused entities is definitely a good idea. But it must be done as a final stage (right before it renders the Go) and not interfere with any other process. It is a significant change and will be released as a new version, but it must be done in the right way. Comments from Reviewable |
Review status: 24 of 30 files reviewed at latest revision, 1 unresolved discussion, some commit checks broke. linux/ctype.go, line 92 at r8 (raw file): Previously, elliotchance (Elliot Chance) wrote…
May be another solution:
Comments from Reviewable |
climate change ParmVarDecl could not match regexp. Fixes #280 (#284) Fixed struct array initialization. #264 (#283) Bump version: v0.16.9 Radium 2017-10-30 Function free(). Fixes #123 (#255) c2go should only output TestApp() when running in test. Fixes #267 (#274) Add support for multi-dimensional arrays. Fixes #279 (#291) Line number should be %d, not %s (#295) Bump version: v0.16.10 Radium 2017-10-31 add more test for ast.Atos
…into Preprocessor
Prototype of preprocessor
Cleaning output Go code
For #232
This change is