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

fix Issue 23143 - ImportC: forward enum declarations need to be suppo… #14277

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

WalterBright
Copy link
Member

…rted

Most of the machinery was already in place, thanks to struct and union tags. Only problem was EnumMembers had a back reference to the EnumDeclaration that had to be adjusted.

@WalterBright WalterBright added Review:Easy Review Feature:ImportC Pertaining to ImportC support labels Jul 9, 2022
@WalterBright WalterBright requested a review from ibuclaw as a code owner July 9, 2022 05:24
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
23143 enhancement ImportC: forward enum declarations need to be supported

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#14277"

@WalterBright WalterBright force-pushed the fix23143 branch 3 times, most recently from 352c52a to 42a7505 Compare July 9, 2022 18:12
@WalterBright
Copy link
Member Author

What broke this?

make: Entering directory '/tmp/phobos'
posix.mak:37: ../dmd/compiler/src/osmodel.mak: No such file or directory

@Geod24
Copy link
Member

Geod24 commented Jul 9, 2022

@WalterBright : As disscussed yesterday, we're in the process of merging druntime into DMD. The CI will be 100% broken until #14281 is merged.

@WalterBright
Copy link
Member Author

Why does every file need extensive rebasing?

@ibuclaw
Copy link
Member

ibuclaw commented Jul 10, 2022

Why does every file need extensive rebasing?

They don't, or you are over thinking it.

(master) $ git fetch walterbright 
From github.com:WalterBright/dmd
 - [deleted]               (none)     -> walterbright/inliner
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 12 (delta 4), reused 10 (delta 4), pack-reused 0
Unpacking objects: 100% (12/12), 127.20 KiB | 1.23 MiB/s, done.
 * [new branch]            fix23143   -> walterbright/fix23143
   15d8805b40..20bd0cacbd  master     -> walterbright/master

(master) $ git switch fix23143 
Branch 'fix23143' set up to track remote branch 'fix23143' from 'walterbright'.
Switched to a new branch 'fix23143'

(fix23143) $ git tree | head
* 42a7505a78 (HEAD -> fix23143, walterbright/fix23143) fix Issue 23143 - ImportC: forward enum declarations need to be supported
*   20bd0cacbd (tag: last-separate-dmd-druntime, walterbright/master) Merge pull request #14280 from ibuclaw/merge_stable
|\  
| * b7b29ca161 Merge remote-tracking branch 'upstream/stable' into merge_stable
|/| 
| * f282f98f7b (tag: v2.100.1, upstream/stable) bump VERSION to v2.100.1
| * fa80a8bb79 (tag: v2.100.1-beta.1, stable) bump VERSION to v2.100.1-beta.1
| * 2c336dfa82 Fix Issue 21443 - scope (failure) with a return breaks safety
| * 10f612d3bc Fix Issue 23172 - [REG2.100] Wrong cast inserted for ternary operator and non-int enums
| * cdd3e2ae54 Fix Issue 23120 - dmd illegal instruction throw expression

(fix23143) $ git rebase upstream/master
Successfully rebased and updated refs/heads/fix23143.

(fix23143) $ git tree | head
* 7a873b115b (HEAD -> fix23143) fix Issue 23143 - ImportC: forward enum declarations need to be supported
*   ddd74e2637 (upstream/master, master) Merge pull request #14285 from Geod24/improvements
|\  
| * cd205fcb52 druntime: Do not build C files with verbose flag
| * f0a8c569b5 Remove now unused CI files / duplicated LICENSE file
* | efcf9c4f01 Azure CI: Disable unit_tests for MSBuild jobs for now due to unclear regression
|/  
* 09d04945bd (tag: first-merged-dmd-druntime, origin/master, origin/HEAD) Fix build script paths to work with new merged repository structure
*   69ab16a7e8 Merge dlang/druntime repository into dlang/dmd
|\  

src/dmd/cparse.d Outdated
@@ -1675,7 +1675,7 @@ final class CParser(AST) : Parser!AST
auto stags = applySpecifier(stag, specifier);
symbols.push(stags);

if (tt.tok == TOK.enum_)
if (0 && tt.tok == TOK.enum_) // C11 proscribes enums with no members, but we allow it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

@ibuclaw ibuclaw Jul 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISO C forbids forward references to enum types, I guess we're picking and choosing what parts of the spec we're going to enforce now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to leave it in in case we want to be strict C11.

@WalterBright
Copy link
Member Author

@ibuclaw thank you. But what are the commands if I'm already sitting on walterbright fix23143 because I'm afraid to update to master as it will wipe out my repository?

@ibuclaw
Copy link
Member

ibuclaw commented Jul 11, 2022

@ibuclaw thank you. But what are the commands if I'm already sitting on walterbright fix23143 because I'm afraid to update to master as it will wipe out my repository?

Just fetch and rebase on master. It won't wipe out your repository.

If you are really paranoid, you can always make a copy of your directory before making any changes. However, git keeps a reference to all state changes in its reflog, so you can always pull up your current changes with git checkout -b old-fix23143 42a7505a78 at any time (until the hash expires in the reflog).

@WalterBright
Copy link
Member Author

@ibuclaw that worked! Thanks for your help.

@dlang-bot dlang-bot merged commit a0f6f84 into dlang:master Jul 12, 2022
@WalterBright WalterBright deleted the fix23143 branch July 12, 2022 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants