Skip to content

builder: simplify generic cc detection - #21380

Merged
spytheman merged 2 commits into
vlang:masterfrom
ttytm:builder/simplify-cc-detect
Apr 30, 2024
Merged

spytheman merged 2 commits into
vlang:masterfrom
ttytm:builder/simplify-cc-detect

Conversation

@ttytm

@ttytm ttytm commented Apr 29, 2024

Copy link
Copy Markdown
Member

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

Comment thread vlib/v/builder/cc.v Outdated
eprintln('Compilation with unknown C compiler')
ccoptions.cc = .unknown
}
cc_ver := os.execute_opt('cc --version') or { panic('unknown C compiler') }

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
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
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.

2 participants