Skip to content
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

Use self hosted translate-c for cImport #4025

Merged
merged 23 commits into from
Jan 2, 2020
Merged

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Jan 1, 2020

This is @Vexu's #3973, merged into a branch, with more commits.

Checklist:

  • Correctly translate -1 type coerced to unsigned long
  • The case noted in Use self hosted translate-c for cImport #3973 (comment)
  • this one gives duplicate decls
    #define bar err(
    #define bar err(
  • Investigate error: use of undeclared identifier '_ArgList' when running tests on Windows
  • Investigate why stdio.h on windows is resulting in exported functions (I would expect them to be static inline)

Vexu and others added 15 commits December 29, 2019 11:04
- fix use of undefined value
- fix parenexprclass result not being suppressed
- add an error and a TODO for access of an anonymous field
According to C11 6.5.6.8, pointer arithmetic may not overflow. In fact,
it may not even go more than 1 past the end of an object, or UB occurs.

This is the same as Zig pointer arithmetic semantics, and so the
`+` and `+=` operators rather than `+%` and `+%=` are appropriate for
C-translated pointer arithmetic.
Block-local identifiers have block-local mangling numbers, and more
consistent mangling is applied within blocks. Parameters, for example,
are treated the same as other block-local variables, and are not mangled
unless they conflict with another name in scope.
 * `std.mem.Compare` is now `std.math.Order` and the enum tags
   renamed to follow new style convention.
 * `std.mem.compare` is renamed to `std.mem.order`.
 * new function `std.math.order`
Widening and truncating integer casting to different signedness
works better now. For example `(unsigned long)-1` is now translated
to zig code that compiles correctly.
This made macros which had an error being processed emit multiple times,
causing the self-hosted compiler to fail to build.
This input file, for example, would produce duplicate identifiers
in the translated Zig code:

```
  #define bar err(
  #define bar err(
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants