Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
958c5c7f
Unverified
Commit
958c5c7f
authored
4 years ago
by
Markus Reiter
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #8349 from reitermarkus/doc-cxxstdlib
Refactor and document `CxxStdlib`.
parents
a72c9717
4eff378d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/cxxstdlib.rb
+8
-13
8 additions, 13 deletions
Library/Homebrew/cxxstdlib.rb
with
8 additions
and
13 deletions
Library/Homebrew/cxxstdlib.rb
+
8
−
13
View file @
958c5c7f
...
...
@@ -2,9 +2,11 @@
require
"compilers"
# Combination of C++ standard library and compiler.
class
CxxStdlib
include
CompilerConstants
# Error for when a formula's dependency was built with a different C++ standard library.
class
CompatibilityError
<
StandardError
def
initialize
(
formula
,
dep
,
stdlib
)
super
<<~
EOS
...
...
@@ -17,8 +19,8 @@ class CxxStdlib
def
self
.
create
(
type
,
compiler
)
raise
ArgumentError
,
"Invalid C++ stdlib type:
#{
type
}
"
if
type
&&
!
[
:libstdcxx
,
:libcxx
].
include?
(
type
)
klass
=
(
compiler
.
to_s
=~
GNU_GCC_REGEXP
)
?
GnuStdlib
:
AppleStdlib
klass
.
new
(
type
,
compiler
)
apple_compiler
=
compiler
.
to_s
.
match?
(
GNU_GCC_REGEXP
)
?
false
:
true
CxxStdlib
.
new
(
type
,
compiler
,
apple_
compiler
)
end
def
self
.
check_compatibility
(
formula
,
deps
,
keg
,
compiler
)
...
...
@@ -35,9 +37,10 @@ class CxxStdlib
attr_reader
:type
,
:compiler
def
initialize
(
type
,
compiler
)
def
initialize
(
type
,
compiler
,
apple_
compiler
)
@type
=
type
@compiler
=
compiler
.
to_sym
@apple_compiler
=
apple_compiler
end
# If either package doesn't use C++, all is well.
...
...
@@ -72,15 +75,7 @@ class CxxStdlib
"#<
#{
self
.
class
.
name
}
:
#{
compiler
}
#{
type
}
>"
end
class
AppleStdlib
<
CxxStdlib
def
apple_compiler?
true
end
end
class
GnuStdlib
<
CxxStdlib
def
apple_compiler?
false
end
def
apple_compiler?
@apple_compiler
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment