-
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
Send clang options with "-clang-flag". Fixes #331 #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
==========================================
- Coverage 81.61% 81.38% -0.24%
==========================================
Files 142 143 +1
Lines 6032 6080 +48
==========================================
+ Hits 4923 4948 +25
- Misses 888 908 +20
- Partials 221 224 +3
Continue to review full report at Codecov.
|
Not ready for review, but welcome - if you know alternative for macro _GNU_SOURCE on MacOSX. |
Reviewed 10 of 12 files at r1, 4 of 4 files at r2. a discussion (no related file): main.go, line 328 at r2 (raw file):
"Pass arguments to clang. You may provide multiple -clang-flag items." main_test.go, line 338 at r2 (raw file):
We must always use main_test.go, line 372 at r2 (raw file):
We must always use main_test.go, line 405 at r2 (raw file):
We must always use tests/multi2/head.h, line 5 at r2 (raw file):
These should be just prototypes, the whole header file should be: #include <stdio.h>
#ifndef HEADER
#define HEADER
void say_four();
void say_two();
#endif /* HEADER */ tests/multi2/main.c, line 1 at r2 (raw file):
If you are going to use the header file for forward-declaring functions you should place the actual functions after the tests/multi2/main.c, line 3 at r2 (raw file):
tests/multi3/1.c, line 4 at r2 (raw file):
Remove these lines. tests/multi3/1.c, line 13 at r2 (raw file):
I don't understand what these files are testing that is different from multi2? tests/multi3/1.h, line 4 at r2 (raw file):
tests/multi4/include/head.h, line 3 at r2 (raw file):
Add the comment above: // multi4 tests that functions can be declared in the header. tests/trigraph/main.c, line 3 at r2 (raw file):
Add the comment above: // Trigraph tests require the `-trigraph` clang option, so it cannot be amount other general tests. This also raised the question. You should have the same file in the Comments from Reviewable |
Review status: 12 of 14 files reviewed at latest revision, 13 unresolved discussions. a discussion (no related file): Previously, elliotchance (Elliot Chance) wrote…
Ok. main.go, line 328 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. main_test.go, line 338 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. main_test.go, line 372 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. main_test.go, line 405 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. tests/multi2/head.h, line 5 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. tests/multi3/1.c, line 4 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
No. case tests/multi3/1.c, line 13 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Main different is - using two *.c files - like in SQLITE, it is happen because if you run tests/multi3/1.h, line 4 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
No. It is really tests/multi4/include/head.h, line 3 at r2 (raw file):
tests/trigraph/main.c, line 3 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. Comments from Reviewable |
👍 Ready for review. |
Review status: 3 of 19 files reviewed at latest revision, 8 unresolved discussions. tests/multi2/main.c, line 1 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
If you want, then I will also that case. tests/multi2/main.c, line 3 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
I will add a new case with without #if and ... Comments from Reviewable |
Reviewed 15 of 16 files at r3, 1 of 1 files at r4. a discussion (no related file): After reviewing the changes I see what's trying to be achieved but it it hard to understand with generic names like "multi2". To make it clear for the next person to maintain we need to be clear about what each of the tests so and how they differ from each other. We can reduce all the multi files into a single folder that contains all of these cases with clear documentation:
#include <stdio>
// This header file is included by multiple C files. Make sure the preprocessor
// is working correctly by not declaring duplicates.
#ifndef HEADER
#define HEADER
// Headers usually do not contain whole functions, but we want to make sure this
// is still OK to do.
void say_four() {
printf("4");
}
// Forward-declared prototypes that are defined in one of our other C files.
void say_two(); // main1.c
void say_three(); // main2.c
#endif /* HEADER */
#include <stdio>
#include "header.h"
int main() {
say_two();
say_three();
say_four();
return 0;
}
// The body for the definition (declared in the header). Notice this is declared
// after using the forward declaration above.
void say_two() {
printf("2");
}
#include <stdio>
#include "header.h"
void say_three() {
printf("3");
} You will still need to keep the I will dismiss all of the discussions on multi files, please create a single multi folder with the examples above. ast/empty_decl.go, line 21 at r3 (raw file):
This is a position so it should be parsed like the line above. transpiler/transpiler.go, line 379 at r4 (raw file):
Fix this? travis/test.sh, line 100 at r4 (raw file):
These two transpile steps need to be combined now: echo "Transpiling sqlite3 source files..."
./c2go transpile $SQLITE_TEMP_FOLDER/$SQLITE3_FILE/sqlite3.c $SQLITE_TEMP_FOLDER/$SQLITE3_FILE/shell.c >> $OUTFILE 2>&1
SQLITE_WARNINGS=`cat $SQLITE_TEMP_FOLDER/sqlite3.go | grep "// Warning" | wc -l` Replace travis/test.sh, line 117 at r4 (raw file):
I dont understand what all this code below here is for? Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions. a discussion (no related file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/empty_decl.go, line 21 at r3 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Ok, so I grep little bit:
May I change on other ast elements? transpiler/transpiler.go, line 379 at r4 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Add warning for future travis/test.sh, line 100 at r4 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done, but not direct like in your snippet. Because:
Not acceptable for clang:
It is happen, because In detail: For solving that, at step 2 we include line at begin of source Now, after combine of travis/test.sh, line 117 at r4 (raw file): Previously, elliotchance (Elliot Chance) wrote…
See upper. Comments from Reviewable |
Reviewed 30 of 30 files at r5. main_test.go, line 132 at r5 (raw file):
Please leave this turned on. I know it makes the tests slower but its important to catch race conditions if they occur because they can be almost impossible to debug. main_test.go, line 315 at r5 (raw file):
As I said with my original comment there is no need to have multiple "cases" this is just confusing and makes the build slow. They are all testing the same thing. You only need three files for a single multi file test. All of the cases can do into those file (as I had documented). ast/empty_decl.go, line 21 at r3 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
All of the other cases can go into another PR. travis/test.sh, line 117 at r4 (raw file): Previously, Konstantin8105 (Konstantin) wrote…
Remove all the code below. We only want to deal with transpiring the amalgamated files to get the warnings right now. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. main_test.go, line 132 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. main_test.go, line 315 at r5 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/empty_decl.go, line 21 at r3 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Ok. travis/test.sh, line 117 at r4 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. Comments from Reviewable |
Reviewed 6 of 35 files at r5, 18 of 23 files at r6. Comments from Reviewable |
See #331
This change is