Avoid throwing unnecessary exceptions by checking for paths existing and
creating formulae as late as possible. Additionally use instance
variables for some caching.
In this case we need to handle the throwing on an exception when
attempting to initialize the gcc48 Formula object.
This initialization should be unnecessary if the core GCC is already
installed and rescued if not.
This code originated in a slightly different form in 8e88b22fd1ec65a344ce6e4facd6dad4b415b2ad:
8e88b22fd1/Library/Homebrew/extend/ENV.rb (L30-L32)
Back then, MacOS.default_compiler could return nil, which meant
ENV.compiler could do the same. This code was carried forward as the
surrounding code changed. At this point it should be unreachable.
On older Apple compilers "-O4" is known to cause build errors. On recent
clang, it's the same as "-O3" and you have to pass "-O3 -flto" to get
the old behavior.
It is activated by the same mechanism as the Homebrew/versions compilers
which now check if the GCC formula uses the same, correct version.
References Homebrew/homebrew#28418.
Rationale: our arg refurbishment is normally only turned on when
called via the `make` wrapper, for compatibility reasons. However,
there are numberous places we'd like this to be turned on elsewhere,
like software that builds via `python setup.py` where bad flags from
the system python can be pulled in.
This helper appends 'O' to CCCFG, which enables refurbishment for
all calls of the compiler shims.
This flag no longer affects the output of the compiler wrappers, since
everything is buffered by the build process rather than each individual
tool.
Additionally, this is a user-facing knob that affects ARGV.verbose?, and
the combination of these two issues broke the --quieter feature.
This raise happened in no other ENV methods, and isn't really necessary
since fails_with guards against this method actually being called unless
gcc-4.2 is actually installed.