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

builder: simplify generic cc detection #21380

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Apr 29, 2024

Reduces nesting / loc by handling a potential fatal error directly.

eprintln('Compilation with unknown C compiler')
ccoptions.cc = .unknown
}
cc_ver := os.execute_opt('cc --version') or { panic('unknown C compiler') }
Copy link
Member

Choose a reason for hiding this comment

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

do not use panics here please

Copy link
Member

Choose a reason for hiding this comment

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

Without that panic, if I do not have cc:
image

With that panic:
image

I really do prefer the first message.

Copy link
Member Author

Choose a reason for hiding this comment

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

K gonna update, currently it is merely a refactor. Pulling the panic from the else block into the or block with no error messages changed.

@ttytm ttytm force-pushed the builder/simplify-cc-detect branch 2 times, most recently from f6a11c0 to 96328b0 Compare April 29, 2024 19:06
@ttytm ttytm force-pushed the builder/simplify-cc-detect branch from 96328b0 to 8ee55e4 Compare April 30, 2024 02:32
@spytheman spytheman merged commit 3861a4b into vlang:master Apr 30, 2024
65 checks passed
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.

None yet

2 participants