From 2e22465aa41d0ff38f9d36562fccffa30eadd086 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 27 Dec 2013 15:46:36 -0600 Subject: [PATCH] Apply the same filtering to -I paths as -L paths --- Library/ENV/4.3/cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index 20c9cc9ae5..93f30ec4f4 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -134,25 +134,29 @@ class Cmd when /^-I(.+)?/ # Support both "-Ifoo" (one argument) and "-I foo" (two arguments) path = $1.chuzzle || whittler.next - args << "-I#{path}" if iset.add?(path.cleanpath) + args << "-I#{path}" if keep?(path) and iset.add?(path.cleanpath) when /^-L(.+)?/ path = $1.chuzzle || whittler.next - doit = case path.cleanpath - when %r{^#{Regexp.escape(brewfix)}}, %r{^#{Regexp.escape(brewtmp)}} - # maybe homebrew is installed to /sw or /opt/brew - true - when %r{^/opt}, %r{^/sw}, %r{/usr/X11} - false - else - true - end - args << "-L#{path}" if doit and lset.add?(path.cleanpath) + args << "-L#{path}" if keep?(path) and lset.add?(path.cleanpath) else args << arg end end args end + + def keep? path + case path.cleanpath + when %r{^#{Regexp.escape(brewfix)}}, %r{^#{Regexp.escape(brewtmp)}} + # maybe homebrew is installed to /sw or /opt/brew + true + when %r{^/opt}, %r{^/sw}, %r{/usr/X11} + false + else + true + end + end + def cflags args = []